Using HTTP Request for Google Dialogflow

不想你离开。 提交于 2019-12-12 11:15:18

问题


https://api.dialogflow.com/v1/query?v=20150910&contexts=shop&lang=en&query=apple&sessionId=12345&timezone=America/New_York

Headers: Authorization: Bearer YOUR_CLIENT_ACCESS_TOKEN

How do i use the above code to make a HTTP Request in Google Dialogflow? How do i add headers as a part of HTTP request


回答1:


You can use the Postman application for sending POST request,

Select Post request in Postman Application,

Copy and paste URL https://api.dialogflow.com/v1/query?v=20150910&contexts=shop&lang=en&query=apple&sessionId=12345&timezone=America/New_York

In headers section, choose Authorization as key and paste the Bearer YOUR_CLIENT_ACCESS_TOKEN

Then, if you click send you will get the proper response in a body.




回答2:


An easy start is to use curl from the command line as in the documentation:

curl \
-H "Authorization: Bearer YOUR_CLIENT_ACCESS_TOKEN" \
"https://api.dialogflow.com/v1/query?v=20150910&contexts=shop&lang=en&query=apple&sessionId=12345&timezone=America/New_York"

Just copy the whole thing and paste it into your command line and you will get a json response.

Ref: https://dialogflow.com/docs/reference/agent/query#get_query_sample



来源:https://stackoverflow.com/questions/49251725/using-http-request-for-google-dialogflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!