Loading...
HTTP Requests
Generic modules are only for use with custom applications. If you use this module to control a device or software on the market that more than you are using, <strong>PLEASE let us know</strong> about this software, so we can make a proper module for it. If we already support this and you use this to trigger a feature our module doesn't support, please let us know. We want Companion to be as easy as possible to use for anyone.
This module lets you send arbitrary HTTP requests (GET / POST / PUT / PATCH / DELETE) to any HTTP or HTTPS endpoint, optionally store parts of the response into custom variables, and display a remote image on a button.
These options are set once per connection in the connection's config page.
An optional starting URL that is prepended to the URL/URI entered in each action, e.g. http://server.url/path/. This is convenient when every action targets the same host.
http:// or https://), the Base URL is ignored for that action.Optional. Routes all requests through an HTTP/HTTPS proxy. Include credentials in the URL if the proxy requires them, e.g. http://username:password@proxy-server:8080.
Controls TLS certificate validation for HTTPS requests. By default the module rejects invalid server certificates (expired, wrong host, untrusted root, or self-signed).
Set this to Accept only if you must connect to a host with a self-signed or otherwise invalid certificate. Doing so disables an important security protection, so use it at your own risk.
By default this module uses Node.js's strict HTTP parser. Some non-compliant devices return malformed responses (for example headers ending in bare LF instead of CRLF), which the strict parser rejects with errors such as HPE_CR_EXPECTED — meaning the response body is never returned.
Setting HTTP Response Parser to Insecure / lenient allows these malformed responses through.
⚠️ Security warning. Strict parsing protects against HTTP request smuggling and response-splitting attacks. Enabling the insecure parser disables that protection for this connection. Only use it with a fully trusted device on a trusted network, and never across the public internet or an untrusted proxy. Prefer fixing the device. Use at your own risk.
All request actions share a common set of options. Not every option applies to every method (see the table below).
| Action | Body | Header | Content Type | Response variables |
|---|---|---|---|---|
| GET | — | ✓ | — | ✓ |
| POST | ✓ | ✓ | ✓ | ✓ |
| PUT | ✓ | ✓ | ✓ | ✓ |
| PATCH | ✓ | ✓ | ✓ | ✓ |
| DELETE | ✓ | ✓ | — | — |
http(s):// URL, which overrides the Base URL).\n sequences in a string body are converted to real newlines. If the Content Type is application/json and the value is an object, it is sent as JSON.{"Authorization": "Bearer token"}. Supports variables. Must be valid JSON or the request is aborted with an error.Content-Type header for methods that send a body (POST/PUT/PATCH). A range of common types is available, including application/json, application/x-www-form-urlencoded, application/xml, text/plain, multipart/form-data, and more.GET, POST, PUT and PATCH can write parts of the response into custom variables:
200, 404).Note: DELETE does not expose the status-code option and does not report a non-2xx response as a connection error.
A request that returns a non-success status code (or fails outright) sets the connection status to an error state and logs the reason. A successful request sets the status back to OK.
Fetches an image from a URL and displays it on the button. Options:
0 to disable polling (the image is fetched once when the feedback is evaluated). Changing the interval restarts the poll timer.The fetched image is scaled to fit the button. If the request fails, the error is logged and nothing is drawn.
Generic
CommunityGeneric
CommunityGeneric
CommunityGeneric
Community