api.ai - 禁止 GET /INTENTS 查询 -
api.ai - Getting forbidden for GET /INTENTS query -
我正在尝试获取意图中的 'user says' 列表。
我遇到了障碍 - 当以下命令不起作用时 - 说禁止。
curl 'https://api.api.ai/v1/intents?v=20150910' -H 'Authorization: Bearer xxxxxx'
如何构造 get 请求以获取每个意图的 'user says'
您似乎使用了错误的访问令牌。要从 api.ai, you need to use "Developer access token", not "Client access token". According to the document 获取 intents
信息:
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.
如果使用"client access token"取intents
,api.ai会return403 forbidden
错误:
{"status":{"code":403,"errorType":"forbidden","errorDetails":"You do not have rights for this operation."}}
此外,如果需要"user says"列表,HTTP请求URL应该包含intent id,例如:
curl -k -H 'Authorization: Bearer YOUR_DEVELOPER_ACCESS_TOKEN' 'https://api.api.ai/v1/intents/<INTENT_ID>?v=20150910'
这是正确的答案 - 我们需要发送开发人员访问令牌
不是客户端访问令牌
我正在尝试获取意图中的 'user says' 列表。 我遇到了障碍 - 当以下命令不起作用时 - 说禁止。 curl 'https://api.api.ai/v1/intents?v=20150910' -H 'Authorization: Bearer xxxxxx'
如何构造 get 请求以获取每个意图的 'user says'
您似乎使用了错误的访问令牌。要从 api.ai, you need to use "Developer access token", not "Client access token". According to the document 获取 intents
信息:
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.
如果使用"client access token"取intents
,api.ai会return403 forbidden
错误:
{"status":{"code":403,"errorType":"forbidden","errorDetails":"You do not have rights for this operation."}}
此外,如果需要"user says"列表,HTTP请求URL应该包含intent id,例如:
curl -k -H 'Authorization: Bearer YOUR_DEVELOPER_ACCESS_TOKEN' 'https://api.api.ai/v1/intents/<INTENT_ID>?v=20150910'
这是正确的答案 - 我们需要发送开发人员访问令牌 不是客户端访问令牌