HTTP, HTTPS and REST API
Send structured sensor data and handle status codes, timeouts, authentication and retries.
Topology and objective
Device HTTP client → HTTPS REST endpoint → response/status handling.
Hardware and tools
- Supported development board
- USB data cable
- Current-limited supply
- Serial monitor and logic analyser when applicable
Security and RF safety
- Validate TLS certificates and clock time.nDo not put tokens in query strings.nLimit payload size and validate server responses.
Practical procedure
- Create a test resource path.nPOST JSON with Content-Type application/json.nValidate 2xx response and returned JSON.nTest 400, 401 and timeout handling.nAdd bounded retry with exponential backoff.
Telemetry / payload
{"device_id":"node-01","temperature":25.2,"battery":92}Starter code / config
POST /api/v1/telemetry HTTP/1.1nContent-Type: application/jsonnAuthorization: Bearer TEST_TOKENExpected results
| Checkpoint | Expected | Tool |
|---|---|---|
| POST | 201/202 and valid response body | Serial / API clientnRetry |
Troubleshooting
| Symptom | Check | Action |
|---|---|---|
| TLS failure | Check time, CA and hostname | Correct trust/time settingsn429 response |
Local-only sandbox
Commands & telemetry simulator
Send command
Simulator ready. No network connection is used.
