Difference between revisions of "Action: HTTP Request"
Line 14: | Line 14: | ||
==== Query Params ==== | ==== Query Params ==== | ||
− | Query Parameters can be set for any given request. A query parameters is supplied as a key, value pair and you can add as many as you need. The query parameters are the ones you typically see within the url string after the ? | + | Query Parameters can be set for any given request. A query parameters is supplied as a key, value pair and you can add as many as you need. The query parameters are the ones you typically see within the url string after the ? for example: |
− | |||
− | |||
<pre> https://www.someurl.com?searchTerm=something </pre> | <pre> https://www.someurl.com?searchTerm=something </pre> | ||
Revision as of 13:58, 31 March 2022
This action can be used to make HTTP requests to a server end-point. This can be used for a variety of purposes but typically use cases are:
- Invoking some functionality on a remote server (WebHook). For example, tell your home automation server to turn of a light
- Request some data from a remote web based endpoint. For example, request the latest weather forecast data from a Weather API.
The HttpRequest action supports the following HTTP request methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE
You can optionally use basic authorization by supplying a username and password for services that support this.
The HTTP Return Code can be saved into an integer variable which indicates if the call was successful or not.
The HTTP response can be saved into a String variable or can be saved directly to a file.
Query Params
Query Parameters can be set for any given request. A query parameters is supplied as a key, value pair and you can add as many as you need. The query parameters are the ones you typically see within the url string after the ? for example:
https://www.someurl.com?searchTerm=something
Content Body
Some HTTP Request types support sending content within the body of the HTTP Request. You can specify the type of context by selecting from the drop down list of common options (or choosing a custom value if your type is not supported).
The actual content can be supplied as text, or direct from an existing file. The contents of a String variable can be used in the standard way using the magic text to replace the variable with it's content s at run time using the following [v=varName].
Header Params
Header Parameters are similar to query parameters but they are sent in the HTTP header instead of being visible in the URL of the request. You can add a key, value pair for each header parameter you require.