0
votes

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.

1

1 Answers

0
votes

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.