GWAPI: Device commands

From Yombo
Jump to: navigation, search

Gateway API Home

Get details on device commands.

Get device command details

Get a listing of all device commands in memory on the local gateway.

  <div id="curl<random_number></random_number>" class="tab-pane fade in active" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
curl \
-H "x-api-auth: kip8EaWvR7Y6eLN2c0t0L2z3oELs3hR0jeEDrAr6Ozm7EB" \
http://localhost:8080/api/v1/device_command/<7eD!>uo0D-p!WK
  <div id="python<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
import requests

url = http://localhost:8080/api/v1/device_command/<7eD!>uo0D-p!WK'
headers = {
    'x-api-key': 'kip8EaWvR7Y6eLN2c0t0L2z3oELs3hR0jeEDrAr6Ozm7EB',
    }

response = requests.get(url, headers=headers)
  <div id="output<random_number></random_number>" class="tab-pane fade" style="border: 1px solid #ccc; border-radius: 5px; padding: 0.7em;">
{
    "code": 200,
    "message": "OK",
    "comments": {},
    "payload": {
        "request_id": "dnmZbNNWoa1iJDoZQw",
        "persistent_request_id": null,
        "source_gateway_id": "E31ebmxkm8M7lRv0",
        "device_id": "x4RE0o7nvP7KN8Q3",
        "command_id": "6qBJKkN6kw3nW",
        "inputs": {},
        "created_at": 1513302218.2532196,
        "broadcast_at": 1513302218.3197937,
        "accepted_at": null,
        "sent_at": 1513302218.270456,
        "received_at": 1513302218.2844048,
        "pending_at": null,
        "finished_at": 1513302218.2984602,
        "not_before_at": null,
        "not_after_at": null,
        "started": true,
        "command_status_received": false,
        "history": [
            [
                1513302218.2532196,
                "unknown",
                "Created.",
                "E31ebmxkm8M7lRv0"
            ],
            [
                1513302218.270456,
                "unknown",
                "Command sent to device or processing sub-system.",
                "E31ebmxkm8M7lRv0"
            ],
            [
                1513302218.2844048,
                "unknown",
                "Command received by the device or processing sub-system.",
                "E31ebmxkm8M7lRv0"
            ],
            [
                1513302218.2984602,
                "unknown",
                "PLM interface not ready.",
                "E31ebmxkm8M7lRv0"
            ],
            [
                1513302218.3197937,
                "unknown",
                "Command broadcasted to hooks and gateway coms.",
                "E31ebmxkm8M7lRv0"
            ]
        ],
        "status": "unknown",
        "requested_by": {
            "user_id": "apiauth:N",
            "component": "yombo.gateway.lib.WebInterface.api_v1.devices_get",
            "gateway": "E31ebmxkm8M7lRv0"
        }
    }
}