0

I'm getting a response from Alchemy API's Sentiment Analysis that says I have an invalid API key.

I'm using a basic HTTP GET request with the params encoded in a js object, like so:

var params = {
    apiKey: kAlchemyApiKey,
    text: text,
    outputMode: 'json'
};

The request is then made like so:

HTTP.get(kSentimentUrl, params);

The API key should be valid (it's a free one though, so I don't know if I need to set up something for it to work).

What could be the problem? Should I use the node.js sdk?

================

Update

the parameter for the api key should be 'apikey' not 'apiKey' as I had done before.

it's now working as expected.

Gilles Major
  • 489
  • 1
  • 3
  • 12

1 Answers1

0

Not sure which api you exactly tried to call, but looking at the documentation for the HTMLGetTextSentiment I see the following remark :

  1. Calls to HTMLGetTextSentiment should be made using HTTP POST.
  2. HTTP POST calls should include the Content-Type header: application/x-www-form-urlencoded

Looking at your text I see you are using a get request and I nowhere see the reference to the form encoding.

This should make no difference what kind of client technology you use to make the REST calls.

See also http://www.alchemyapi.com/api/sentiment/htmlc.html for the reference of the api.

  • Hello the url I'm trying to call is: 'https://access.alchemyapi.com/calls/text/TextGetTextSentiment'. Unfortunately, still getting invalid-api-key after changing the request to post and making sure the content-type is application/x-www-form-urlencoded – Gilles Major Jul 15 '15 at 14:46