API: Nodes
From Yombo
- Overview
- Quick start
- Various Topics
- Manage Results
- Core Resources
- Other resources
Summary
Nodes are used to store nearly any type of data. Modules can use to store extra configuration or user data. The data can be binary or text up to 5 megabytes. Note: Max total data size limit will be enforced when a node is created or updated. If a users' maximum storage limit is reached, the node will not be saved or updated.
GET - All nodes
Retrieve all nodes available to the current user.
Filters
List of available filters:
- id
- node_type
- label
- machine_label
- gateway_id
- weight
- always_load
- status
- created_at
- updated_at
Request URLs
- GET https://api.yombo.net/api/v1/node
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/node?_filters[machine_label]=module_phone_bandwidth&_pagelimit=1
<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/node?_filters[machine_label]=module_phone_bandwidth&_pagelimit=1'
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;">
{
"response": {
"uri": "/api/v1/node?_filters[machine_label]=module_phone_bandwidth&_pagelimit=1",
"uri_description": "List nodes.",
"doc_uri": "https://yombo.net/API:Nodes",
"node": [
{
"id": "LdRevqk9p6rKZV24",
"parent_id": "",
"user_id": "wE9v8xp4pqa0GQbrde",
"gateway_id": "E31ebmxkm8M7lRv0",
"node_type": "module_phone_bandwidth",
"weight": 0,
"label": "Module Phone Bandwidth",
"machine_label": "module_phone_bandwidth",
"always_load": 1,
"destination": "gw",
"data": "{\"allowed\":[],\"phones\":{\"allowed\":[]},\"active_phones\":{\"x2m8V37ebPO06zrX\":{\"send\":1,\"receive\":1,\"pin\":\" aaka\"
}",
"data_content_type": "json", "status": 1, "created_at": 1517722722, "updated_at": 1517738066 } ], "locator": "node", "locator_type": "objects" }, "code": 200, "warnings": [], "filters": [ { "field": "machine_label", "operator": "=", "search": "module_phone_bandwidth" } ], "filter_operator": "and", "pages": { "total_items": 2, "page_limit": 1, "total_pages": 2, "page_start": 1 }, "message": "OK", "html_message": "OK"
} }}
GET - Specific node
Retrieve a specific node id.
Request URLs
- GET https://api.yombo.net/api/v1/node/{node_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/node/aWvzB0ENZ23JO
<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/node/aWvzB0ENZ23JO
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;">
{
"response": {
"uri": "/api/v1/node/LdRevqk9p6rKZV24",
"uri_description": "Detailed information for a single node.",
"doc_uri": "https://yombo.net/API:Nodes",
"node": {
"id": "LdRevqk9p6rKZV24",
"parent_id": "",
"user_id": "wE9v8xp4pqa0GQbrde",
"gateway_id": "E31ebmxkm8M7lRv0",
"node_type": "module_phone_bandwidth",
"weight": 0,
"label": "Module Phone Bandwidth",
"machine_label": "module_phone_bandwidth",
"always_load": 1,
"destination": "gw",
"data": "{\"allowed\":[],\"phones\":{\"allowed\":[]},\"active_phones\":{\"x2m8V37ebPO06zrX\":{\"send\":1,\"receive\":1,\"pin\":\" aaka\"
}",
"data_content_type": "json", "status": 1, "created_at": 1517722722, "updated_at": 1517738066 }, "locator": "node", "locator_type": "object" }, "code": 200, "warnings": [], "message": "OK", "html_message": "OK"
} }}
POST - Create new node
Creates a new node.
Request URLs
- POST https://api.yombo.net/api/v1/node
Parameters
Name | Type | Description |
---|---|---|
Required | ||
node_type | string | A string to help search for node types. No predefined list. Can only contain: a-z and _ (underscore). |
node_type | string/binary | Whatever data you want stored. Typically, this is one of: json, msgpack, json_zip, msgpack_zip. Other ideas can be: binary, jpeg, gif. |
Optional | ||
parent_id | string | For parent/sibling/child relationships, list the parent node. |
gateway_id | string | If this node should be associated with a gateway, put the gateway id here. |
label | string | A short human friendly label for the none. |
machine_name | string | Machine name for this none. Once set, this shouldn't be changed, but this is not enforced. Can only contain: a-z and _ (underscore). |
weight | integer | Default: 0 - Useful if nodes should be sorted. |
description | string | A detailed description of what the input type checks for. |
always_load | integer | Default: 0 - Just another attribute you can use for anything. The gateway uses this to load some nodes into memory on startup or when receiving updates. |
destination | string | Like always_load, can be used for anything you want. If 'gw' is used, this will always be sent to the gateway when the gateway requests updates or first starts. |
status | integer | Default: 1 - Status for the node. |
DELETE - Delete a node
Delete a node. This doesn't actually delete the node right away, but simply marks it for deletion later. This is the same as setting the status to 2. To undelete the node, simply change the status back to 1.
Request URLs
- DELETE https://api.yombo.net/api/v1/node/{node_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..." \
-X DELETE https://api.yombo.net/api/v1/node/LdRevqk9p6rKZV24
<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/node/LdRevqk9p6rKZV24'
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;">
{
"response": {
"uri": "/api/v1/node/LdRevqk9p6rKZV24",
"uri_description": "Delete a node.",
"doc_uri": "https://yombo.net/API:Nodes",
"node": "Deleted",
"locator": "node",
"locator_type": "string"
},
"code": 200,
"warnings": [],
"message": "Deleted",
"html_message": "Deleted"
}