The following methods are available on tasks :
- get.list.tasks
- get.object.task
- set.property.task
- doaction.task
- delete.alltasks
- delete.task
- add.task
- replace.task
get.list.tasks
Syntax
{"jsonrpc":"2.0","method":"get.list.tasks","id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "get.list.tasks",
"id": 1
}
Optional “level” parameter
{"jsonrpc":"2.0","method":"get.list.tasks","params":{"level":"task"}, "id": 1}
This will return the full list of tasks with varying degree of details.
Indented display
{
"jsonrpc": "2.0",
"method": "get.list.tasks",
"params": {
"level": "task"
},
"id": 1
}
Parameters
This level
parameter is optional but can be used to retrieve more exhaustive information from the tasks
Parameter | Description |
---|---|
"level":"task" |
This will only list the task and not their subtasks. This level returns the same as if no level was specified |
"level":"subtask" |
This level will nest an additional JSON Array Litteral inside each task containing a JSON Object Litteral for each subtask in the task |
Returns
Level : task
Note that omitting the level parameter will default to this level.
The JSON Object Litterals for the tasks will have the following properties:
Property | Description |
---|---|
keyword | Keyword to filter a task |
name | Name of the task |
objectType | For this method, this field contains task |
taskEnable | If the task is enabled/disabled |
triggerDeviceUuid | uuid of the device set as a trigger, if present |
triggerEnable | If it is possible to trigger the task |
triggerParam1-6 | 6 fields of parameters present for the trigger device |
triggered | Indicate if this task was recently launched. true if the task was launched less than 2 seconds ago, false otherwise |
uiColor | Color assigned to the task |
uuid | uuid of the task |
Representation
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
↑
-- TASK #1 information --
↓
},
{
↑
-- TASK #2 information --
↓
},
[etc.] ← Lists all tasks on the server
]
}
Level : subtask
Returns the complete list of tasks and will nest an additional JSON Array Litteral inside each task containing a JSON Object Litteral for each subtask in the task.
The JSON Object Litterals for the cues will have the following properties:
Property | Description |
---|---|
action | Action run by the subtask on the target device |
color | Color set on the subtask |
objectType | For this method, this field contains subtask |
param1 | Subtask parameter #1 (varies depending on the subtask) |
param2 | Subtask parameter #1 (varies depending on the subtask) |
param3 | Subtask parameter #1 (varies depending on the subtask) |
taskOjbectUuid | uuid of the device that is targeted by the subtask |
uuid | uuid of the subtask |
wait | Wait time before the subtask should be launched (in ms) |
Representation
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"keyword": "",
"name": "",
"objectType": "task",
"subtasks": [
{
↑
-- SUBTASK #1 information --
↓
},
{
↑
-- SUBTASK #2 information --
↓
},
[...] ← Lists all subtasks in the task
],
"taskEnable": true,
↑
-- Rest of TASK information --
↓
}
]
}
get.object.task
Syntax
{"jsonrpc":"2.0","method":"get.object.task", "params": {"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "get.object.task",
"params": {
"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"
},
"id": 1
}
Optional “level” parameter
{"jsonrpc":"2.0","method":"get.object.task", "params": {"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}", "level":"subtask"}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "get.object.task",
"params": {
"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}",
"level": "subtask"
},
"id": 1
}
Parameters
Parameter | Description |
---|---|
uuid | uuid of the task |
name | Name of the task |
This level
parameter is optional but can be used to retrieve more exhaustive information from the tasks
Parameter | Description |
---|---|
"level":"task" |
This will only list the task and not their subtasks. This level returns the same as if no level was specified |
"level":"subtask" |
This level will nest an additional JSON Array Litteral inside each task containing a JSON Object Litteral for each subtask in the task |
The “level” parameter functions in the same way as for the get.list.tasks method. Refer to the documentation above for more details.
Returns
If “level” is set to “task”, returns the following properties of the target task.
Property | Description |
---|---|
keyword | Keyword to filter a task |
name | Name of the task |
objectType | For this method, this field contains task |
taskEnable | If the task is enabled/disabled |
triggerDeviceUuid | uuid of the device set as a trigger, if present |
triggerEnable | If it is possible to trigger the task |
triggerParam1-6 | 6 fields of parameters present for the trigger device |
triggered | Indicate if this task was recently launched. true if the task was launched less than 2 seconds ago, false otherwise |
uiColor | Color assigned to the task |
uuid | uuid of the task |
If “level” is set to “subtask”, returns the following additional JSON Object Litteral with the following properties for every subtask in the target task:
Property | Description |
---|---|
action | Action run by the subtask on the target device |
color | Color set on the subtask |
objectType | For this method, this field contains subtask |
param1 | Subtask parameter #1 (varies depending on the subtask) |
param2 | Subtask parameter #1 (varies depending on the subtask) |
param3 | Subtask parameter #1 (varies depending on the subtask) |
taskOjbectUuid | uuid of the device that is targeted by the subtask |
uuid | uuid of the subtask |
wait | Wait time before the subtask should be launched (in ms) |
set.property.task
Syntax
{"jsonrpc":"2.0","method":"set.property.task", "params":{"uuid":"{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}","property":"taskEnable","value":true}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "set.property.task",
"params": {
"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}",
"property": "taskEnable",
"value": true
},
"id": 1
}
Parameters
Use this command to modify one target property on a task.
It is possible to target the following properties:
Property | Type | Description |
---|---|---|
keyword | String | Keyword to filter a task |
name | String | Name of the task |
taskEnable | Boolean | Set to true to enable the task or false to disable the task |
triggerEnable | Boolean | Set to true to enable the trigger of the task or false to disable the trigger |
uiColor | String | RGB hexadecimal value for the color of the task. Must be prefixed with the # character |
Returns
The "result"
property in the JSON response will contain a boolean : true
if the instruction was executed correctly or false
otherwise.
doaction.task
Syntax
{"jsonrpc":"2.0","method":"doaction.task", "params":{"uuid":"{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}","action":"launch"}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "doaction.task",
"params": {
"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}",
"action": "launch"
},
"id": 1
}
Parameters
Use this command to do an action on a target task.
Currently only the launch action can be sent to trigger the launch of task.
Returns
If the "action"
parameter is valid, the JSON will return "result": true
.
If tthe "action"
parameter is invalid, or specified name or uuid is invalid, the JSON will return a message with "Invalid params"
.
delete.alltasks
Syntax
{"jsonrpc":"2.0","method":"delete.alltasks", "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "delete.alltasks",
"id": 1
}
Returns
The "result"
property in the JSON response will contain a boolean : true
if the instruction was executed correctly or false
otherwise.
delete.task
Syntax
{"jsonrpc":"2.0","method":"delete.task", "params":{"uuid":"{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "delete.task",
"params": {
"uuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"
},
"id": 1
}
Parameters
Parameter | Description |
---|---|
uuid | uuid of the task |
name | Name of the task |
Returns
The "result"
property in the JSON response will contain true
if the instruction was executed correctly.
If the payload is not properly formatted, the server will respond by sending back the payload.
add.task
Syntax
{"jsonrpc":"2.0","method":"add.task", "params":{"aftertaskuuid":"{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"}, "id": 1}
Indented display
{
"jsonrpc": "2.0",
"method": "add.task",
"params": {
"aftertaskuuid": "{45c8566e-435d-4abb-ad3a-2800cb1ce1c5}"
},
"id": 1
}
Parameters
Parameter | Description | Information |
---|---|---|
aftertaskuuid | uuid of the task after which the new task will be created | Target the task either by name or by uuid. |
aftertaskname | Name of the task after which the new task will be created | If several tasks have the same name, the first one will be targeted. |
data | JSON Object Litteral containing the data of the task to create |
The "data"
parameter contains a JSON Object Litteral with the properties you would like to give to your new Task.
Refer to the construction described in the above methods to create the "data"
JSON Object Litteral.
Empty Object
Specifying the properties is optional and if an empty object is given, e.g. "data":{}
a task will be created with default properties.
UUID
Do not specify any "uuid"
properties in the JSON Object Litteral, the server will create them automatically.
Level of detail
The "data"
Object can be constructed with the same level of details as presented by the subtask
level of the get.list.tasks method.
Returns
The "result"
property in the JSON response will contain true
if the instruction was executed correctly.
If the payload is not properly formatted, the server will respond by sending back the payload.
replace.task
Syntax
{"jsonrpc":"2.0","method":"replace.task", "params":{"data":{"uuid":"{c7a5713c-df74-42a9-a46e-32fabf503957}", "name":"Replaced Task"}},"id":1}
Indented display
{
"jsonrpc": "2.0",
"method": "replace.task",
"params": {
"data": {
"uuid": "{c7a5713c-df74-42a9-a46e-32fabf503957}",
"name": "Replaced Task"
}
},
"id": 1
}
Parameters
Parameter | Description |
---|---|
data | JSON Object Litteral containing the data of the task to create and the uuid of the task to replace |
UUID
With this method, you must specify a uuid
in the data properties.
This will indicate to the method which task to replace.
The uuid
will be conserved and a new one will not be generated.
All the other properties of the task will be replaced by the properties specified in the data parameter.
Refer to the construction described in the above methods to create the "data"
JSON Object Litteral.
Level of detail
The "data"
Object can be constructed with the same level of details as presented by the subtask
level of the get.list.tasks method.
Returns
The "result"
property in the JSON response will contain true
if the instruction was executed correctly.
If the payload is not properly formatted, the server will respond by sending back the payload.
Need more help with this?
Don’t hesitate to contact us here.