Lab 1 — ingest
Use a sandbox factory created in ops, not the public demo-food plant, when practising token rotate.
HTTP
- Sign in as plant admin.
- Registry → add device code
LAB-TEMP, type temperature, unit °C. - Copy ingest token.
- Send:
curl -X POST https://iot.factoraerp.com/api/ingest \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"value": 4.2, "messageId": "lab-1"}'
- Confirm the reading on the device page. Repeat the same
messageId— count must not double.
MQTT
Broker: iot.factoraerp.com:1883 (no TLS claimed).
mqtt pub -h iot.factoraerp.com -p 1883 \
-u LAB-TEMP -P '<token>' \
-t factora/<slug>/devices/LAB-TEMP/telemetry \
-m '{"value": 9.4, "messageId": "lab-mqtt-1"}'
Wrong factory slug in the topic is rejected. Wrong password is rejected.
Paused factory: plant login fails; do not expect ingest as a “feature” for paused tenants.
Walk the screen

- Create a sandbox factory in ops. Do not practise on the shared demo-food plant.
- In the sensor registry, add a temperature device with the code you will use as the MQTT username.
- Send one HTTP reading with a bearer token and a message id. Confirm it on the device.
- Repeat the same message id and confirm the count does not increase.
- Publish MQTT to that factory's topic. A wrong slug or a wrong secret is rejected.
- Do not expect ingest to be a feature of a paused factory. Plant login already fails there.
Worked example
LAB-TEMP receives value 4.2 with message id lab-1 over HTTP. The second post with lab-1 does not double the count. The MQTT post uses the same device code and a new message id. The registry list is the screenshot to use in class. Do not open the token on a projector.
Common mistakes
- Rotating a token on the shared demo plant.
- Changing the message id on a retry and double-counting.
- Putting the wrong factory slug in the topic and expecting it to land.
Recap
- Sandbox factory, then register, then HTTP, then MQTT.
- The same message id must not double the count.
- The username is the device code. The topic includes the factory slug.
