tanhakabir / rest-book

REST Book is a Visual Studio Code extension that allows you to perform REST calls in a Notebook interface.
https://marketplace.visualstudio.com/items?itemName=tanhakabir.rest-book
MIT License
249 stars 24 forks source link

How do I set Header values required for REST API calls, e.g. Authorization keys #99

Closed jlandgrave62 closed 3 years ago

jlandgrave62 commented 3 years ago

For Example, Yelp requires and Authorization Header and fails without it:

"request": { "method": "GET", "httpVersion": "1.1", "responseUrl": "https://api.yelp.com/v3/businesses/search?term=delis&latitude=37.786882&longitude=-122.399972", "timeout": 10000, "params": { "term": "delis", "latitude": "37.786882", "longitude": "-122.399972" }, "headers": { "User-Agent": "rest-book" } }, "data": { "error": { "code": "VALIDATION_ERROR", "description": "Authorization is a required parameter.", "field": "Authorization", "instance": null } }

jlandgrave62 commented 3 years ago

Figured it out! Add the Bearer token as a secret called "Bearer" and then use the secret with the Authorization Keyword, e.g.:

GET https://api.yelp.com/v3/businesses/search?term=delis&latitude=37.786882&longitude=-122.399972 Authorization: Bearer $SECRETS.Bearer