TAŇBA-OOH Developers

Acknowledge a signed command

POST /d/v1/commands/{id}/ack

https://devices.tanba-ooh.kz/d/v1/commands/{id}/ack

The signed body names the command. command_id must equal the id in the path, otherwise the answer is 400 command_id_mismatch, so the signed acknowledgement of one command cannot be posted to another. An acknowledgement without command_id is accepted for one more release and counted, then refused.

Authentication

Client certificate of the device (mutual TLS) and a signature of the body by the device key.

Parameters

NameInTypeRequiredDescriptionExample
X-Tanba-SignatureheaderstringyesES256 signature of the exact bytes of the body by the device key, raw r||s (64 bytes), base64url without padding.q3J2y0uO8e1m4n7pXc5Zk9d2Wv6Tg0hLsB-aRfN1YjE6uHxPzD3oVtKiC8wMbQe2nSgA4rUl7yFhJ9XcT0dZaw
idpathstring (uuid)yesIdentifier of the command being acknowledged.0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10

Request body

application/json

NameTypeRequiredDescriptionExample
command_idstring (uuid)The command acknowledged; it must equal the id in the path."0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10"
okbooleanyesTrue when the player carried the command out.true
state_snapshotobjectThe state of the player after the command.

Example

{
  "command_id": "0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10",
  "ok": true,
  "state_snapshot": {
    "state": "cutoff"
  }
}

Responses

200 Recorded.

application/json

NameTypeRequiredDescriptionExample
statusstringyesAlways recorded. recorded

Example

{
  "status": "recorded"
}

Errors

Errors are problem documents (application/problem+json) with a stable code.

StatusMeaning
400The body is not JSON (invalid_json) or command_id differs from the path (command_id_mismatch).
404Nothing there, or not visible to the caller.
defaultAn error as a problem document.

Code samples

curl

curl -X POST 'https://devices.tanba-ooh.kz/d/v1/commands/0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10/ack' \
  -H 'X-Tanba-Signature: q3J2y0uO8e1m4n7pXc5Zk9d2Wv6Tg0hLsB-aRfN1YjE6uHxPzD3oVtKiC8wMbQe2nSgA4rUl7yFhJ9XcT0dZaw' \
  -H 'Content-Type: application/json' \
  -d '{
  "command_id": "0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10",
  "ok": true,
  "state_snapshot": {
    "state": "cutoff"
  }
}'
Python
import requests

response = requests.post(
    "https://devices.tanba-ooh.kz/d/v1/commands/0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10/ack",
    headers={
        "X-Tanba-Signature": "q3J2y0uO8e1m4n7pXc5Zk9d2Wv6Tg0hLsB-aRfN1YjE6uHxPzD3oVtKiC8wMbQe2nSgA4rUl7yFhJ9XcT0dZaw",
        "Content-Type": "application/json",
    },
    json={
        "command_id": "0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10",
        "ok": True,
        "state_snapshot": {
            "state": "cutoff",
        },
    },
)
print(response.status_code, response.text)
Go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "command_id": "0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10",
  "ok": true,
  "state_snapshot": {
    "state": "cutoff"
  }
}`)
	req, err := http.NewRequest("POST", "https://devices.tanba-ooh.kz/d/v1/commands/0b1c3a52-6f0e-4c2e-9d3a-2f5d1e7a9c10/ack", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("X-Tanba-Signature", "q3J2y0uO8e1m4n7pXc5Zk9d2Wv6Tg0hLsB-aRfN1YjE6uHxPzD3oVtKiC8wMbQe2nSgA4rUl7yFhJ9XcT0dZaw")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	data, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.Status, string(data))
}