Difference between revisions of "Action: HTTP Request"
Line 1: | Line 1: | ||
+ | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | ||
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: | 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: | ||
Line 11: | Line 12: | ||
The HTTP response can be saved into a String variable or can be saved directly to a file. | The HTTP response can be saved into a String variable or can be saved directly to a file. | ||
− | + | </pre> | |
==== Query Params ==== | ==== Query Params ==== | ||
Latest revision as of 19:04, 29 January 2024
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 [https://en.wikipedia.org/wiki/List_of_HTTP_status_codes 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 (such as POST and PUT) 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 contents 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.