API documentation
When integrating the Efento Gateway with a custom application or server, several key factors must be considered to ensure reliable communication, data integrity, and security:
Message Format and Structure
Messages from the gateway are sent in JSON format and may include:
Measurements messages, containing logger data, measurement timestamps, and parameter values.
Heartbeat messages, containing gateway status, power information, logger count, and uptime.
Server Response Requirements
The server must respond with HTTP status code
201 Createdfor every message sent by the gateway. If any other response is returned, the gateway will interpret the message as not received and will resend it repeatedly until a valid acknowledgment is received. This ensures no data is lost due to temporary network interruptions or server errors.A
503 Service Unavailableresponse indicates that the server is temporarily unable to process the request—for example, due to maintenance, overload, or other temporary conditions. Efento Gateway receives a 503 response, it will pause for 5 minutes and then attempt to resend the data.Your application must correctly parse these messages to extract measurements, identify loggers, and handle synchronization instructions sent to the gateway in the server response.
Custom headers
You can configure up to ten custom HTTP headers on the Gateway. These headers are included with every message sent by the gateway and can be used, for example, to authenticate the gateway with your server.
Security Considerations
Ensure that communication between the gateway and your server is encrypted using TLS/SSL (HTTPS). You may upliad custom certificates to the Gateway
Validate any API keys or tokens sent via custom headers to prevent unauthorized access.
Measurements
The measurements message provides logger data collected by the Efento Gateway and sent to the server in JSON format. Each message can contain multiple measurements, either from a single logger—such as when the gateway reconnects to the Internet and resends stored data—or from multiple loggers if several are within the gateway’s range. This structure allows efficient transmission of all relevant sensor data in one message.
The JSON body includes key details about each measurement, including the logger serial number, battery and signal status, measurement timestamps, and the recorded parameters with their values and statuses.
ENDPOINT
/api/v4/measurements
(default endpoint, can be overwritten in Server settings)
METHOD
POST
HEADERS
Content-Type: application/json
charset=UTF-8
X-Api-Token: <value of the “Organization Token” field> <Name of the 1st custom header>: <Value of the 1st custom header> <Name of the 2nd custom header>: <Value of the 2nd custom header> ...
The structure of the measurements JSON is as follows:
Examples of the messages sent by Efento Gateway to the server:
The server must respond with “201 Created” for each message received from the Efento Gateway. If any other response is returned, the gateway will treat the message as not received and will resend it repeatedly until a valid response is received.
Additionally, the server’s response body should be a JSON containing a list of accepted loggers IDs and indicate whether the gateway should save in its memory and synchronize the measurements of these loggers with the server. Each logger ID corresponds to the “response_handle” field sent by the gateway in the original JSON message.
Example of the response body sent to the gateway:
Heartbeat
The heartbeat message provides regular status updates from the Efento Gateway. These messages are by default sent automatically every 15 minutes and allow monitoring of the gateway’s health, connectivity, and power status. The HTTP request body contains the information in JSON format, detailing key parameters such as gateway identification, software version, uptime, logger count, and power status.
This message helps ensure that the gateway is operating correctly and allows the server or cloud platform to track its status in real time. On the other hand, it allows for proactive monitoring and helps detect issues such as power outages, connectivity problems, or unexpected gateway downtime.
ENDPOINT
/api/v4/gateways/heartbeat
(default endpoint, can be overwritten in Server settings)
METHOD
POST
HEADERS
Content-Type: application/json
charset=UTF-8
X-Api-Token: <value of the “Organization Token” field> <Name of the 1st custom header>: <Value of the 1st custom header> <Name of the 2nd custom header>: <Value of the 2nd custom header> ...
The structure of the heartbeat JSON is as follows:
Example of a heartbeat message:
The server must respond with “201 Created” for each message received from the Efento Gateway. If any other response is returned, the gateway will treat the message as not received and will resend it repeatedly until a valid response is received.
503 response code
A 503 Service Unavailable response indicates that the server is temporarily unable to process the request—for example, due to maintenance, overload, or other temporary conditions. When the Efento Gateway receives a 503 response, it will pause for 5 minutes and then attempt to resend the data.
If the server responds with 201 Created after the retry, the gateway will continue transmitting all remaining buffered measurements. However, if the server again returns 503, the gateway will wait another 5 minutes and repeat the process.
This retry mechanism ensures that no data is lost during temporary server downtime and applies to both types of messages: measurements and heartbeat.
Last updated