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;">
 1 {
 2     "data": [
 3         {
 4             "type": "categories",
 5             "id": "vleRWgpRJ5hj0ao3m",
 6             "attributes": {
 7                 "id": "vleRWgpRJ5hj0ao3m",
 8                 "parent_id": "vleRWgpRJ5hj0ao3m",
 9                 "category_type": "input_type",
10                 "machine_label": "input_type",
11                 "label": "Input Type",
12                 "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.",
13                 "status": 1,
14                 "created_at": 1482065386,
15                 "updated_at": 1482065386
16             }
17         },
18         {
19             "type": "categories",
20             "id": "5M9logKwykI7gRVbJ",
21             "attributes": {
22                 "id": "5M9logKwykI7gRVbJ",
23                 "parent_id": "5M9logKwykI7gRVbJ",
24                 "category_type": "input_type",
25                 "machine_label": "address",
26                 "label": "Address",
27                 "description": "Various device addressing input formats.",
28                 "status": 1,
29                 "created_at": 1482065387,
30                 "updated_at": 1482065387
31             }
32         }
33     ],
34     "meta": {
35         "count": 2,
36         "current_page": 1,
37         "from": 1,
38         "last_page": 16,
39         "path": "https://api.yombo.net/api/v1/categories",
40         "per_page": 2,
41         "to": 2,
42         "total": 31,
43         "includable": []
44     },
45     "links": {
46         "first": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=1",
47         "last": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=16",
48         "prev": null,
49         "next": "https://api.yombo.net/api/v1/categories?page%5Bsize%5D=2&page%5Bnumber%5D=2",
50         "self": "https://api.yombo.net/api/v1/categories"
51     }
52 }

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;">
 1 {
 2     "data": {
 3         "type": "categories",
 4         "id": "vleRWgpRJ5hj0ao3m",
 5         "attributes": {
 6             "id": "vleRWgpRJ5hj0ao3m",
 7             "parent_id": "vleRWgpRJ5hj0ao3m",
 8             "category_type": "input_type",
 9             "machine_label": "input_type",
10             "label": "Input Type",
11             "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.",
12             "status": 1,
13             "created_at": 1482065386,
14             "updated_at": 1482065386
15         }
16     },
17     "links": {
18         "self": "https://api.yombo.net/api/v1/categories/vleRWgpRJ5hj0ao3m"
19     },
20     "meta": {
21         "includable": []
22     }
23 }

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;">
 1 {
 2     "type": "categories",
 3     "id": "categories",
 4     "attributes": {
 5         "sortable": [
 6             "category_type",
 7             "machine_label",
 8             "label",
 9             "status",
10             "created_at",
11             "updated_at"
12         ],
13         "includable": [],
14         "filterable": [
15             "parent_id",
16             "category_type",
17             "machine_label",
18             "label",
19             "status",
20             "created_at",
21             "updated_at"
22         ]
23     }
24 }
This page was last edited on 12 April 2019.