Lesson 3.5 Postman
Postman is a graphical HTTP client for exploring and calling the IoT platform's REST API - logging in, reading devices, pushing data, and running saved request collections. In this lesson you'll authenticate, read your devices, push a value, and (optionally) bulk-import time series.
The full API is documented in Swagger (https://staging.yggio.net/swagger).
Before you start
- Install Postman.
- An IoT platform account (username + password).
- Optional: create a Postman environment with variables
baseUrl = https://staging.yggio.netand (later)token, so requests read{{baseUrl}}and{{token}}.
Exercise 1 - Get an access token
- New request →
POST{{baseUrl}}/api/auth/local. - Body → raw → JSON:
{ "username": "YOUR_USERNAME", "password": "YOUR_PASSWORD" }
- Send. The response contains a
token. Copy it (or, in the Tests tab, save it automatically:pm.environment.set("token", pm.response.json().token)).
All authenticated calls use the header
Authorization: Bearer <token>.
Exercise 2 - List your devices
- New request →
GET{{baseUrl}}/api/iotnodes. - Headers:
Authorization: Bearer {{token}}. - Send - you get every device with its current fields. Add a query to
filter, e.g.
{{baseUrl}}/api/iotnodes?q=temperaturefor devices that have atemperaturefield.
Exercise 3 - Push a value to a generic device
- In the IoT platform, create a Generic device with a
secret(see Lesson 2.3). The secret is an API key - keep it private. - New request →
POST{{baseUrl}}/http-push/generic?identifier=secret. - Headers:
Content-Type: application/json. - Body → raw → JSON (include the
secret):{ "secret": "YOURDEVICESECRET", "temperature": 22 } - Send - the device updates in the IoT platform. (This endpoint uses the device secret, not the Bearer token.)
Exercise 4 - Bulk-import time series from a CSV (optional)
The IoT platform ships a ready-made Postman collection that reads a CSV and posts each row as a timestamped reading - see Lesson 1.4 for the full walkthrough. In short:
- Import the CSV-import collection.
- Add a temporary
secretto the target device viaPUT {{baseUrl}}/api/iotnodes/{_id}. - Point the collection at your CSV and set the
secretin the request body, then Run the collection. - Remove the temporary secret afterwards (
PUT …/api/iotnodes/{_id}with{ "secret": "$unset" }).
⚠️ Imported time-series data cannot be changed or removed - test with a small file first.
What you learned
- How to get a token from
POST /api/auth/localand useAuthorization: Bearer. - How to read devices (
GET /api/iotnodes) and push data (POST /http-push/generic). - Where to find the CSV time-series import collection.
Where next
- Lesson 3.6 Curl - the same calls from the command line.
- Lesson 1.4 Exporting and Importing Data with CSV.