API: Device types

From Yombo
Jump to: navigation, search

Summary

Devices such as Insteon lamps and switches, wifi locks, etc, are all device types. Each device type can have one or more commands assigned to them. For example, lamps can be turned on, off, or set to a specific brightness.

GET - All device types

Retrieve all device types available to the current user. This includes public and private device types specific to the user.

Request URL

  • GET https://api.yombo.net/api/v1/device_types

Parameters

None

Example

  <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-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
https://api.yombo.net/api/v1/device_types?page[size]=2
  <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 = 'https://api.yombo.net/api/v1/device_types?page[size]=2'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }
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;">
{
    "data": [
        {
            "type": "categories",
            "id": "vleRWgpRJ5hj0ao3m",
            "attributes": {
                "id": "vleRWgpRJ5hj0ao3m",
                "parent_id": "vleRWgpRJ5hj0ao3m",
                "category_type": "input_type",
                "machine_label": "input_type",
                "label": "Input Type",
                "description": "Types of various inputs. Usually used to help user setting up devices and also used by devices to determine what type of input to expect.",
                "status": 1,
                "created_at": 1482065386,
                "updated_at": 1482065386
            }
        },
        {
            "type": "categories",
            "id": "5M9logKwykI7gRVbJ",
            "attributes": {
                "id": "5M9logKwykI7gRVbJ",
                "parent_id": "5M9logKwykI7gRVbJ",
                "category_type": "input_type",
                "machine_label": "address",
                "label": "Address",
                "description": "Various device addressing input formats.",
                "status": 1,
                "created_at": 1482065387,
                "updated_at": 1482065387
            }
        }
    ],
    "meta": {
        "count": 2,
        "current_page": 1,
        "from": 1,
        "last_page": 16,
        "path": "https://api.yombo.net/api/v1/categories",
        "per_page": 2,
        "to": 2,
        "total": 31,
        "includable": []
    },
    "links": {
        "first": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=1",
        "last": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=16",
        "prev": null,
        "next": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=2",
        "self": "https://api.yombo.net/api/v1/categories"
    }
}

GET - Specific device type

Retrieve a specific device type id.

Request URLs

  • GET https://api.yombo.net/api/v1/device_types/{category_id}

Parameters

None

Example

  <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-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
https://api.yombo.net/api/v1/device_types/vleRWgpRJ5hj0ao3m
  <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 = 'https://api.yombo.net/api/v1/device_types/vleRWgpRJ5hj0ao3m
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }
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;">
{
    "data": {
        "type": "categories",
        "id": "vleRWgpRJ5hj0ao3m",
        "attributes": {
            "id": "vleRWgpRJ5hj0ao3m",
            "parent_id": "vleRWgpRJ5hj0ao3m",
            "category_type": "input_type",
            "machine_label": "input_type",
            "label": "Input Type",
            "description": "Types of various inputs. Usually used to help user setting up devices and also used by devices to determine what type of input to expect.",
            "status": 1,
            "created_at": 1482065386,
            "updated_at": 1482065386
        }
    },
    "links": {
        "self": "https://api.yombo.net/api/v1/categories/vleRWgpRJ5hj0ao3m"
    },
    "meta": {
        "includable": []
    }
}

GET - Meta Information

Get the current meta information. Used for sorting, filtering, and relations.

Request URL

  • DELETE https://api.yombo.net/api/v1/device_types/meta}

Parameters

None

Example

  <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-key: abc123xyz789" \
-H "authorization: Bearer Waro7g0Mwl4YBJ..." \
-X DELETE https://api.yombo.net/api/v1/device_types/meta
  <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 = 'https://api.yombo.net/api/v1/device_types/meta'
headers = {
    'x-api-key': 'abc123xyz789',
    'authorization': 'Waro7g0Mwl4YBJ...',
    }

response = requests.put(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;">
{
    "type": "categories",
    "id": "categories",
    "attributes": {
        "sortable": [
            "category_type",
            "machine_label",
            "label",
            "status",
            "created_at",
            "updated_at"
        ],
        "includable": [],
        "filterable": [
            "parent_id",
            "category_type",
            "machine_label",
            "label",
            "status",
            "created_at",
            "updated_at"
        ]
    }
}