0
votes

Hi I used the deploy to bluemix button at the top right of this page

https://alchemy-language-demo.mybluemix.net/?cm_mc_uid=69990450306114782046823&cm_mc_sid_50200000=1478206651

to create an Alchemy language node server. It runs ok -

https://alchemylanguage-nodejs-encekxdev-216.mybluemix.net/

but when I try to post to it using postman I get the response 'internal server error'.

Checking the server logs, it seems to respond to the request with

code: 'EBADCSRFTOKEN', error: 'invalid csrf token'

Even if I try to send the csrf from the webpage version of the site, it still doesn't work.

I feel like I have missed something in the configuration of the server but don't know what. I'm not great with servers etc so sorry if this is super basic.

EDIT - I should mention I have also tried sending an apikey in the request which I got from the service credentials section in the alchemy service bit off the dashboard but the same error occurs.

EDIt - The call to the API I am making looks like this:

POST https://alchemylanguage-nodejs-encekxdev-216.mybluemix.net/api/keywords

with headers:

text: 'this is some dummy text I have made'

I have also tried adding apikey to the headers.

Thanks.

1
Could you please add more details on your post request? Which API are you using? I tried with some APIs and post is working fine for me (both using curl and postman).Alex da Silva
Thanks @AlexdaSilva for trying it out - I have edited the question to show which API I am using (I think - if not please feel free to direct me). Thanks again!jperry1147

1 Answers

1
votes

You do not POST your application, you have to POST to the API. Here is the link with API URL and various samples:

http://www.ibm.com/watson/developercloud/alchemy-language/api/v1

For example, here is a curl request for keywords:

curl -X POST \ -d "outputMode=json" \ -d "url=http://www.twitter.com/ibmwatson" \ "https://gateway-a.watsonplatform.net/calls/url/URLGetRankedKeywords?apikey=$API_KEY"

Make sure you export $API_KEYto your environment before running the command above. You can find the $API_KEY in the AlchemyAPI instance you created in Bluemix.