Matt Jerry
Matt Jerry

Reputation: 521

api.ai - Getting forbidden for GET /INTENTS query -

I am trying to get the 'user says' list in the intents. I hit the road block - when the following command doesn't work - says forbidden. curl 'https://api.api.ai/v1/intents?v=20150910' -H 'Authorization: Bearer xxxxxx'

How do I frame the get request to get the 'user says' for each intent

Upvotes: 2

Views: 248

Answers (2)

Matt Jerry
Matt Jerry

Reputation: 521

Exactly this is the correct answer - We need to send Developer access token not client access token

Upvotes: -1

shaochuancs
shaochuancs

Reputation: 16246

It seems you used the wrong access token. To get intents information from api.ai, you need to use "Developer access token", not "Client access token". According to the document:

There are two access tokens for each agent. The developer access token is used for managing entities and intents, and the client access token is used for making queries.

If "client access token" is used to fetch intents, api.ai will return 403 forbidden error:

{"status":{"code":403,"errorType":"forbidden","errorDetails":"You do not have rights for this operation."}}

Moreover, if "user says" list is needed, the HTTP request URL should include intent id, such as:

curl -k -H 'Authorization: Bearer YOUR_DEVELOPER_ACCESS_TOKEN' 'https://api.api.ai/v1/intents/<INTENT_ID>?v=20150910'

Upvotes: 2

Related Questions