2017-09-08 39 views

回答

-1

究竟这是正确的答案 - 我们需要发送令牌开发者访问不是客户端访问令牌

2

看来你使用了错误的访问令牌。要从api.ai获得intents信息,您需要使用“开发者访问令牌”,而不是“客户端访问令牌”。按照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.

如果 “客户端访问令牌” 被用来获取intents,api.ai将返回403 forbidden错误:

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

而且,如果 “用户说” 需要名单, HTTP请求的URL应包括意向的ID,如:

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

这是正确答案 –

+0

@MattJerry如果这是正确的答案,也许你可以将其标记为接受? – shaochuancs

+0

@MattJerry请参考https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work“接受答案是重要的,因为它既奖励海报解决你的问题,并告知其他人你的问题解决了。“ – shaochuancs