API: Input types
- Overview
- Quick start
- Various Topics
- Manage Results
- Core Resources
- Other resources
Summary
Input types are used for user input validation. This can be used for entering device variables, device commands, and more. This allows the gateway to validate and optionally coerce user input into a certain formats.
GET - All input types
Retrieve all input types available to the current user. This includes public input types and private input types specific to the user.
Filters
List of available filters:
- id
- label
- machine_label
- description
- public
- status
- created_at
- updated_at
Request URLs
- GET https://api.yombo.net/api/v1/input_type
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/input_type?_pagelimit=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/input_type?_pagelimit=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;">
{
"response": {
"uri": "/api/v1/input_type?_pagelimit=2",
"uri_description": "List of input types.",
"doc_uri": "https://yombo.net/API:Input_types",
"input_type": [
{
"id": "YnDNnDa6",
"category_id": "dD8X67zW",
"machine_label": "x10_house",
"label": "X10 House",
"description": "X10 House code only. A letter A-P.",
"input_regex": "",
"public": 2,
"status": 1,
"created_at": 1482065387,
"updated_at": 1482065387,
"category_label": "X10",
"category_type": "input_type"
},
{
"id": "PLDAaDBX",
"category_id": "dD8X67zW",
"machine_label": "x10_unit",
"label": "X10 Unit Code",
"description": "An X10 unit code. A number between 1 and 16.",
"input_regex": "",
"public": 2,
"status": 1,
"created_at": 1482065387,
"updated_at": 1482065387,
"category_label": "X10",
"category_type": "input_type"
}
],
"locator": "input_type",
"locator_type": "objects"
},
"code": 200,
"warnings": [],
"pages": {
"total_items": 28,
"page_limit": 2,
"total_pages": 14,
"page_start": 1
},
"message": "OK",
"html_message": "OK"
}
GET - Specific input type
Retrieve a specific input type id.
Request URLs
- GET https://api.yombo.net/api/v1/input_type/{input_type_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/input_type/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/input_type/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/input_type/YnDNnDa6",
"uri_description": "Detailed information for a single input type.",
"doc_uri": "https://yombo.net/API:Input_types",
"input_type": {
"id": "YnDNnDa6",
"category_id": "dD8X67zW",
"machine_label": "x10_house",
"label": "X10 House",
"description": "X10 House code only. A letter A-P.",
"input_regex": "",
"public": 2,
"status": 1,
"created_at": 1482065387,
"updated_at": 1482065387,
"category_label": "X10",
"category_type": "input_type"
},
"locator": "input_type",
"locator_type": "object"
},
"code": 200,
"warnings": [],
"message": "OK",
"html_message": "OK"
}
POST - Create new input type
Creates a new input type. Rules for public and status fields apply.
Request URLs
- POST https://api.yombo.net/api/v1/input_type
Parameters
Name | Type | Description |
---|---|---|
Required | ||
machine_name | string | Machine name for this input type. Once set, this cannot be changed. Can only contain: a-z and _ (underscore). |
label | string | A short human friendly label for the input type. |
description | string | A detailed description of what the input type checks for. |
category_id | string | What category this input type belongs to. Be sure to use a 'category type' of 'input_type'. |
Optional | ||
input_regex | string | A regex string that is used to validate the input. |
status | integer | Default: 1 - Status for the input type. |
public | integer | Default: 0 - If the input type should be public. |
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 POST -d '{"label": "New Input Type", "machine_name": "new_input_type",
"description": "A new input type.", "category_id": "Zr8Raq01"}' \
https://api.yombo.net/api/v1/input_type
<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/input_type'
headers = {
'x-api-key': 'abc123xyz789',
'authorization': 'Waro7g0Mwl4YBJ...',
}
payload = {
"label": "New Input Type",
"machine_name": "new_input_type",
"description": "A new input type.",
"category_id": "Zr8Raq01"
}
response = requests.post(url, headers=headers, json=payload)
<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/input_type",
"uri_description": "Create new input type.",
"doc_uri": "https://yombo.net/docs/api/#input-types",
"input_type": {
"machine_label": "new_input_type",
"label": "New Input Type",
"description": "A new input type.",
"category_id": "Zr8Raq01",
"updated_at": 1518689953,
"created_at": 1518689953,
"id": "b6QxVNwj"
},
"locator": "input_type",
"locator_type": "object"
},
"code": 201,
"warnings": [],
"message": "Created",
"html_message": "Created"
}
PUT / PATCH - Update an input type
Update an input type. When using PUT, all required parameters must be sent. When using PATCH, only send in desired changes.
Request URLs
- PATCH https://api.yombo.net/api/v1/input_type/{input_type_id}
- PUT https://api.yombo.net/api/v1/input_type/{input_type_id}
Parameters
See post new input type parameters.
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 PUT -d '{"description": "A new input type, that does everything."}' \
https://api.yombo.net/api/v1/input_type/WQ9akXabloyqb
<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/input_type/WQ9akXabloyqb'
headers = {
'x-api-key': 'abc123xyz789',
'authorization': 'Waro7g0Mwl4YBJ...',
}
payload = {
"description": "A new input type, that does everything.",
}
response = requests.put(url, headers=headers, json=payload)
<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/input_type/b6QxVNwj",
"uri_description": "Update (patch) input type.",
"doc_uri": "https://yombo.net/API:Input_types",
"input_type": {
"id": "b6QxVNwj",
"category_id": "Zr8Raq01",
"machine_label": "new_input_type",
"label": "New Input Type",
"description": "A new input type, that does everything.",
"platform": null,
"public": 0,
"status": 1,
"created_at": 1518689953,
"updated_at": 1518690221,
"category_label": "Input Type",
"category_type": "input_type"
},
"locator": "input_type",
"locator_type": "object"
},
"code": 200,
"warnings": [],
"message": "Updated",
"html_message": "Updated"
}
DELETE - Delete a input type
Delete an input type. This doesn't actually delete the input type right away, but simply marks it for deletion later. This is the same as setting the status to 2. To undelete the input type, simply change the status back to 1.
Request URLs
- DELETE https://api.yombo.net/api/v1/input_type/{input_type_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/input_type/b6QxVNwj
<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/input_type/b6QxVNwj'
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/input_type/b6QxVNwj",
"uri_description": "Delete a input type.",
"doc_uri": "https://yombo.net/API:Input_types",
"input_type": "Deleted",
"locator": "input_type",
"locator_type": "string"
},
"code": 200,
"warnings": [],
"message": "Deleted",
"html_message": "Deleted"
}