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] Internal server error for programmatic search

Paul R Alexander palexander at stanford.edu
Fri Dec 20 11:36:36 PST 2013


You will need to pass along your API Key using the ‘apikey=YOUR_APIKEY’ parameter when you do the request from code. It gets stored in a browser cookie and so you may be able to access from your browser just fine.

Here is some sample java code for doing search (The API key here gets set in a header, but passing the apikey query string parameter works as well):
https://github.com/ncbo/ncbo_rest_sample_code/blob/master/java/src/ClassesSearch.java

Paul


On Dec 19, 2013, at 12:16 PM, Maxwell Neal <mneal at u.washington.edu> wrote:

> Hi all,
> 
> I am in the process of adapting some existing Java code that I use to programmatically search ontologies in BioPortal.  When I try to open a connection to the following BioPortal REST URL, I get an HTTP 500 error.
> 
> http://data.bioontology.org/search?q=brainstem&ontologies=FMA&format=xml&exact_match=0
> 
> When I paste the same URL into my browser, I do get a successful search result.
> 
> Is this really an error on the BioPortal side, as the HTTP code indicates? (I've included a snippet of my code below, in case it's useful.)
> 
> Many thanks,
> 
> M
> 
> 
> String text = "brainstem";
> String bioportalID = "FMA";
> SAXBuilder builder = new SAXBuilder();
> Document doc = null;
> text = text.replace(" ", "+");
> URL url = new URL(
> 	"http://data.bioontology.org/search?q="
> 		+ text + "&ontologies="
> 		+ bioportalID + "&format=xml" + "&exact_match=" + exactmatch);				
> 			
> System.out.println(url);
> URLConnection yc = url.openConnection();
> yc.setReadTimeout(60000); // Timeout after a minute
> BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
> 
> 
> 
> 
> ---------------------------------
> Maxwell Neal
> 
> Post-doctoral researcher
> Department of Bioengineering
> University of Washington
> mneal at uw.edu
> ---------------------------------
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> bioontology-support mailing list
> bioontology-support at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/bioontology-support



More information about the bioontology-support mailing list