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

Maxwell Neal mneal at u.washington.edu
Fri Dec 20 14:04:52 PST 2013


Hi Paul,

Thanks very much for the help.  When I use the API key parameter in my Java code I still get the same HTTP 500 error. Here's an example:

http://data.bioontology.org/search?q=brainstem&ontologies=FMA&format=xml&exact_match=0&apikey=c4192e4b-88a8-4002-ad08-b4636c88df1a

Again, this call works fine in a browser, but not from my Java code.

Cheers,

M

---------------------------------
Maxwell Neal

Post-doctoral researcher
Department of Bioengineering
University of Washington
mneal at uw.edu
---------------------------------








On Dec 20, 2013, at 2:36 PM, Paul R Alexander wrote:

> 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
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20131220/5ba6711e/attachment.html>


More information about the bioontology-support mailing list