HTTPS alternative
When a device can't keep an MQTT connection open, it can send telemetry over HTTPS with the same JWT it would use for MQTT. This page shows you the call and its limits.
When to use it
| Use HTTPS when | Prefer MQTTS when |
|---|---|
| The device wakes up rarely and sends a single message | The device sends data often |
| Your network only allows outbound HTTPS | The device needs commands, configuration, actions or firmware updates |
| You're testing a payload from a script | You need states, heartbeats or named telemetry topics |
Over HTTPS, a device can only send telemetry. Everything the platform sends to the device needs MQTTS.
Before you begin
- The device is provisioned, and you know its project ID, registry ID and serial number. See Provisioning.
- You can sign a device JWT. See Connect over MQTTS.
1. Sign a device JWT
Sign a JWT with the device private key (RS256), with aud set to the project ID and iat and exp set. Store it in $JWT.
2. Post the telemetry
curl -s -X POST \
https://devices.fundamentum-iot.com/api/v3/projects/<project-id>/regions/1/registries/<registry-id>/devices/<serial-number>/telemetry \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"temperature": 21.4, "door": "open"}'
The body is any JSON object. The platform forwards it, unchanged, to the project's default telemetry stream, like an MQTT message on <prefix>/events. There's no HTTPS equivalent of named topics (events/<name>).
3. Check the response
| Status | Meaning |
|---|---|
200 |
Accepted: {"status": "success"} |
400 |
The request is invalid |
401 |
The Authorization header is missing |
403 |
The JWT doesn't authorize this device |
Heartbeats and states over HTTPS
The Devices API also has POST …/devices/<serial-number>/heartbeat and GET …/devices/<serial-number>/states. These are management endpoints: they take an OAuth user or service-account token, not the device JWT. A device in the field should send heartbeats over MQTTS.
What's next
- API reference in Swagger UI: Devices API v3
- Topics to consume the telemetry.
- Devices API v3 reference for the full endpoint list.