Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] ontology link

Li, Yuli yuli.li at yale.edu
Tue Dec 1 12:34:23 PST 2015


Hi,

I would like to get JSON data from the link below by using java

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F166001/children

why java returned ‘<h1>Not Found</h1>’

see code below:

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
public class Client {

public static final String  url = "http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F166001/children";


    public static void main( String[] args ) {
        try {
            HttpClient client = new HttpClient();
            client.getParams().setParameter(
            HttpMethodParams.USER_AGENT," Client Example ");  //Set this string for your application


            PostMethod method = new PostMethod(url);
            method.addParameter("apikey", “my code 1c8a69b3...”)            // Execute the POST method
            int statusCode = client.executeMethod(method);

            if( statusCode != -1 ) {
                try {
                String contents = method.getResponseBodyAsString();
                method.releaseConnection();
                System.out.println(contents);
                }
                catch( Exception e ) {
                    e.printStackTrace();
                }
            }
        }
        catch( Exception e ){
            e.printStackTrace();
        }
    }

}

Why always get “Not Found”,

Could you please let me know how to get content by java?

Thanks,

Yuli


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20151201/60fe2c68/attachment.html>


More information about the bioontology-support mailing list