Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:55:20+00:00 2026-06-01T12:55:20+00:00

I am trying to interact with the NCBO annotator by setting a few parameters,

  • 0

I am trying to interact with the NCBO annotator by setting a few parameters, then executing the request. However, the query returns an error: “Forbidden: A valid API key is required to call REST services. Please visit http://bioportal.bioontology.org/account to get your API key.”

My scala code is as follows:

val annotatorUrl = "http://rest.bioontology.org/obs/annotator"

val client = new DefaultHttpClient()

var method = new HttpPost(annotatorUrl)

val params = new BasicHttpParams

params.setParameter("longestOnly", "true")
params.setParameter("wholeWordOnly", "true")
params.setParameter("filterNumber", "true")
params.setParameter("stopWords", "")
params.setParameter("withDefaultStopWords", "true")
params.setParameter("isTopWordsCaseSensitive", "false")
params.setParameter("mintermSize", "3")
params.setParameter("scored", "true")
params.setParameter("withSynonyms", "true")
params.setParameter("ontologiesToExpand", "")
params.setParameter("ontologiesToKeepInResult", "")
params.setParameter("isVirtualOntologyId", "true")
params.setParameter("semanticTypes", "")
params.setParameter("levelMax", "0")
params.setParameter("mappingTypes", "null")
params.setParameter("textToAnnotate", query)
params.setParameter("format", "xml")

params.setParameter("apikey", "MY_API_KEY")
method.setParams(params)

val response = client.execute(method)
return response.toString()

That returns “HTTP/1.1 403 Forbidden [Date: Mon, 02 Apr 2012 21:41:13 GMT, Server: Apache/2.2.13 (Red Hat), Content-Length: 401, Vary: Accept-Encoding, Connection: close, Content-Type: text/xml;charset=UTF-8]”

If I run the line:

return method.getParams().getParameter("apikey").toString()

it returns my correct api key, so it seems that that is being set correctly.

Any ideas as to what I am doing incorrectly?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:55:22+00:00Added an answer on June 1, 2026 at 12:55 pm

    I was able to solve it by:

    var method = new HttpPost(annotatorUrl)
    val params = new ArrayList[BasicNameValuePair]()
    
    params.add(new BasicNameValuePair("apikey", apikey))
    params.add(new BasicNameValuePair("textToAnnotate", query))
    etc.
    
    method.setEntity(new UrlEncodedFormEntity(params))
    

    Still not sure why setParams didn’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get python to interact with dbus and screensaver however it flatly
I'm using Mechanize to interact with a few web pages, and I'm trying to
I'm trying to interact with an application over the network which uses a simple
I am trying to interact with the windows command prompt from code. My goal
I am trying to develop a mobile application which can interact with a MOSS
I'm using OleDb to interact with an Access database, and I'm trying to find
I'm having a bit of trouble trying to understand how WARP could potentially interact
I am trying to interact with Sharepoint lists via Unity 3D and C#. Most
I'm trying to interact with a webcam from Java on Windows (without going through
I am trying to create a java program that will interact with jUDDI to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.