REST API: Control leases. Generated from the OpenAPI document.
Who controls the robot
GET /v1/control
none, a brain on the MessagePack API, or a REST lease. Send your Nao-Lease header to learn whether it is yours.
Token: required · Lease: not needed
| Status | Meaning | Body |
|---|---|---|
| 200 | Who controls the robot | ControlStatus |
| 401 | Missing or wrong token | ErrorBody |
Take control
POST /v1/control
Returns a lease id for the Nao-Lease header of every command. Keep it with a heartbeat at least every 100 ms; the robot stands after 0.5 s of silence, sits after 3 s, and the lease ends after 10 s. The robot starts with no motion commanded. Fails while a brain is connected.
Token: required · Lease: not needed
Request body (application/json)
| Field | Type | Required | Meaning |
|---|---|---|---|
client | string | yes | Who is asking (shown in status and logs), 1 to 64 printable characters. (example joystick-app) |
takeover | boolean | no | Replace another client's lease. Never replaces a connected brain. |
| Status | Meaning | Body |
|---|---|---|
| 201 | You control the robot now; it starts with no motion | LeaseGrant |
| 409 | A brain is connected (brain_connected) or another client holds the lease (lease_held) | ErrorBody |
| 422 | Invalid input | ErrorBody |
Give control back
DELETE /v1/control
The robot then behaves as when a brain disconnects: it stands, then sits.
Token: required · Lease: required (Nao-Lease header)
| Status | Meaning | Body |
|---|---|---|
| 204 | Released; the robot stands, then sits, as when a brain disconnects | |
| 409 | Not the active lease | ErrorBody |
| 428 | No Nao-Lease header | ErrorBody |
Keep control
POST /v1/control/heartbeat
Any command counts as a heartbeat too.
Token: required · Lease: required (Nao-Lease header)
Control over a WebSocket
GET /v1/control/ws
Upgrade to a WebSocket (browsers pass the token as ?access_token=). Send hello first; the
socket then holds the lease until it closes. Messages are WsClientMessage (client to robot)
and WsServerMessage (robot to client) as JSON text. Send something at least every 100 ms:
the robot stands after 0.5 s of silence and sits after 3 s, as with any controller. The messages are on WsClientMessage and WsServerMessage.
Token: required · Lease: not needed
| Status | Meaning | Body |
|---|---|---|
| 101 | Switching to the WebSocket protocol | |
| 401 | Missing or wrong token | ErrorBody |
| 503 | Too many streams open | ErrorBody |