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

Michael Dorf mdorf at stanford.edu
Tue Dec 1 16:25:53 PST 2015


Hi Yuli,

You are making a POST call to a service endpoint that requires a GET. This endpoint does not accept POST calls. See docs here:

http://data.bioontology.org/documentation#Class

Michael



On Dec 1, 2015, at 12:34, Li, Yuli <yuli.li at yale.edu<mailto:yuli.li at yale.edu>> wrote:

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



_______________________________________________
bioontology-support mailing list
bioontology-support at lists.stanford.edu<mailto:bioontology-support at lists.stanford.edu>
https://mailman.stanford.edu/mailman/listinfo/bioontology-support

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20151202/1925a20a/attachment-0001.html>


More information about the bioontology-support mailing list