GET & POST: Interact with APIs of other online services!

WHY?

You want to get data from or send data to other online services? Yes!! The web request in a spreadsheet is now a thing. GET() to perform it on a URL and return the response in the cell. And you can use POST() to send information to a URL.

How to use GET()

Syntax: =GET(action url, [headers, [return type]]).

  • Action url - URL where the HTTP request is performed.
  • Headers (optional) - raw headers to be sent (as json).
  • Return type - (optional) - returns response in different format: None - returns response content. 0 - returns response content. 1 - returns status. 2 - returns JSON which includes all of the response.

Example: =GET("https://api.ipify.org/?format=json").

Returns value: Response from server in JSON format.

How to use POST()

Syntax: =POST(action url, headers, body, [return type]).

  • Action url - URL where the HTTP request is performed.
  • Headers - raw headers to be sent (as json).
  • Body - body to be sent (as json, which is type “application/json”).
  • Return type - (optional, 0 by default) - returns response in different format. None - returns response content. 0 - returns response content. 1 - returns status. 2 - returns JSON which includes all of the response.

Example: =POST("https://httpbin.org/post",'{}','{"hello":"world"}', 0).

Returns value: Response from server in JSON format.

Authentication

Many APIs require you to identify yourself with some form of credentials or another. You can learn here how to use it in dashdash.