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
From Postman, create a new Request and select the “Authorization” tab and choose Type "OAuth 2.0". Click 'Get New Access Token'. See the Dialogflow API Rest reference for the full list of APIs you can query. From Postman, enter the API you want to query in the GET field.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With