HTTP
HTTP Client
The HTTP Client device allows OnlyView to send HTTP requests to external web servers and APIs for integration with web services, REST APIs, and other HTTP-based systems.
Setup
To configure an HTTP Client device:
- Access the Devices section
- Click Add Device and select HTTP client
- Configure the device settings:
- Device name: Enter a descriptive name for this HTTP client
- Base URL: The server address (e.g.,
http://192.168.1.200:8000) - Authentication: Optional HTTP authentication settings
- Method: Choose "None" or "Basic"
- Login: Username for Basic authentication
- Password: Password for Basic authentication
HTTP Messages
The HTTP Client device can send multiple predefined messages, each with its own configuration:
Message Configuration
For each message, configure:
- Name: User-friendly name for the message
- Endpoint: The specific path to call (e.g., /setStatus)
- Method: HTTP method - GET, POST, PATCH or PUT
- Content type: Value of the Content-Type header (see below)
- Output data (POST, PATCH, PUT): Request body (e.g., JSON data like {"on": true})
Content Type
Many REST APIs reject a request body without the right Content-Type header. The choices are:
| Content type | Header sent |
|---|---|
| None (default) | No header. For POST only, application/x-www-form-urlencoded is sent anyway |
| Auto | Guessed from the output data, see below |
| Form | application/x-www-form-urlencoded |
| JSON | application/json |
| XML | application/xml |
| Plain text | text/plain |
Auto only looks at the first character of the output data, ignoring spaces:
{or[: JSON<: XML- anything else: Plain text
- empty output data: no header
Auto does not check that the data is valid JSON or XML.
API Keys
Some devices expect an API key in the URL instead of a login and password. Put it in the endpoint, e.g. /api/core/io/65536?ApiKey=1234, and leave the authentication method to "None".
Response Validation
Each message can optionally validate the server response:
- Check result: Enable to validate the response content
- Expected result: Text that must be present in the response for success (e.g., {"success": "1"})
The device widget in UserScreens will show green when requests succeed (HTTP 200) and the expected response is received (if validation is enabled). Otherwise, it appears red.
Periodic Status Checks
Enable automatic periodic status checks: - Periodically check status: Enable automatic checking - Period: Check interval in seconds (1-3600) - Message to send: Which configured message to use for periodic checks
Actions
The HTTP Client device supports one action type:
Send HTTP Message
Sends one of the configured HTTP messages to the target server.
When creating this action, select which predefined message to send from the dropdown list.
ActionGraph Node
The HTTP Client device includes an ActionGraph node for integration into automation workflows:
HTTP Sender Node
Properties: - Device: Reference to the HTTP Client device configuration
Input Slots: - Endpoint: HTTP endpoint path (string) - Verb: HTTP method like GET, POST, etc. (string) - Body: Request body content (string)
Input Events: - Send request: Triggers the HTTP request
Output Slots: - Error code (200 : OK): HTTP status code from response (integer) - Data: Response body content (string)
Output Events: - Next (immediately after): Fired immediately when request is sent - On success: Fired when request completes successfully (HTTP 200) - On error: Fired when request fails or returns an error status
The node sends an HTTP request using the connected device configuration when the "Send request" input event is triggered. The input slots allow you to dynamically specify the endpoint, HTTP method, and request body, overriding the device's predefined messages.
The node does not send a Content-Type header, whatever the verb. Use the HTTP Send Message node if the server requires one.
HTTP Send Message Node
Sends one of the messages configured in the device, with its method, content type and output data.
Properties: - Device: Reference to the HTTP Client device configuration
Input Slots: - Message name: Name of the message to send (string). It must match exactly. If two messages have the same name, the first one is sent.
Input Events: - Send request: Sends the message
Output Slots and Events: Same as the HTTP Sender node. "On success" only means that the request succeeded: the Expected result of the message only changes the color of the UserScreen widget.
If no message has this name, a log is written and "On error" is fired.