API: Locations

From Yombo
Jump to: navigation, search

Summary

Locations can be used to define where gateways are installed and/or devices are located at. This allows commands such as 'all lights in family room off'. There are two types of locations:

  1. Location - A broad designation such as 'House', 'Guest House', 'Pool House' (we all should be so lucky).
  2. Area - A more defined designation such as: 'Family Room', 'Kitchen', 'Den' or 'Backyard'. Area's are found inside a Location.

GET - All Loations

Retrieve all locations available to the current user. Locations are not shared between users.

Request URL

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

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/locations?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/locations?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 location

Retrieve a specific location id.

Request URLs

  • GET https://api.yombo.net/api/v1/locations/{location_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/locations/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/locations/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/locations/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/locations/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/locations/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"
        ]
    }
}