Web API/en: различия между версиями
(Новая страница: «= Devices =») |
(Новая страница: «error parameters:») |
||
(не показано 168 промежуточных версий этого же участника) | |||
Строка 618: | Строка 618: | ||
= Devices = | = Devices = | ||
− | == | + | == Getting a list of user devices (list) == |
request: | request: | ||
Строка 624: | Строка 624: | ||
Request URL: [site]/api/device/list | Request URL: [site]/api/device/list | ||
− | + | request parameters: (int) controller_id, (string) token | |
− | + | Request example: | |
<pre> | <pre> | ||
{ | { | ||
Строка 635: | Строка 635: | ||
response: | response: | ||
− | + | ||
− | + | Sample answer: | |
− | |||
<pre> | <pre> | ||
{ | { | ||
"0":{ | "0":{ | ||
"id":"122", | "id":"122", | ||
− | "external_id":"19", //id | + | "external_id":"19", // id at the Controller |
"controller_id":"6", | "controller_id":"6", | ||
"name":"Сирена", | "name":"Сирена", | ||
− | "type_id":"2", // | + | "type_id":"2", //device type |
− | "codes":":{ // | + | "codes":":{ //codes (buttons) |
"0":{ | "0":{ | ||
"id":"218", | "id":"218", | ||
Строка 668: | Строка 667: | ||
}, | }, | ||
"state":"1", | "state":"1", | ||
− | "on_dashboard":"1", // | + | "on_dashboard":"1", //show at Homepage |
"active":"1" | "active":"1" | ||
}, | }, | ||
Строка 675: | Строка 674: | ||
"external_id":"22", | "external_id":"22", | ||
"controller_id":"6", | "controller_id":"6", | ||
− | "name":" | + | "name":"XXXXXX", |
"type_id":"3", | "type_id":"3", | ||
"codes": ... , | "codes": ... , | ||
Строка 686: | Строка 685: | ||
− | == | + | == Device Information (info) == |
request: | request: | ||
Строка 692: | Строка 691: | ||
Request URL: [site]/api/device/info/ | Request URL: [site]/api/device/info/ | ||
− | + | request parameters: | |
(int) controller_id, | (int) controller_id, | ||
Строка 700: | Строка 699: | ||
(string) token | (string) token | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 711: | Строка 711: | ||
response: | response: | ||
− | + | response parameters: | |
− | + | ||
− | + | Sample answer: | |
<pre> | <pre> | ||
{ | { | ||
Строка 756: | Строка 756: | ||
− | == | + | == Update Device Information (update) == |
request: | request: | ||
Строка 772: | Строка 772: | ||
(string) token, | (string) token, | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 783: | Строка 784: | ||
response: | response: | ||
− | + | response parameters: | |
− | + | ||
− | + | Sample answer: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 792: | Строка 794: | ||
</pre> | </pre> | ||
− | == | + | == Deleting a device (delete) == |
request: | request: | ||
Строка 798: | Строка 800: | ||
Request URL: [site]/api/device/delete/ | Request URL: [site]/api/device/delete/ | ||
− | + | request parameters: | |
(int) device_id, | (int) device_id, | ||
Строка 804: | Строка 806: | ||
(string) token | (string) token | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 814: | Строка 817: | ||
response: | response: | ||
− | + | Parameters of the answer: | |
+ | |||
+ | Sample answer: | ||
− | |||
<pre> | <pre> | ||
{ | { | ||
Строка 825: | Строка 829: | ||
− | == | + | == Getting weather data (last) == |
request: | request: | ||
Request URL: [site]/api/device/meteo-last/ | Request URL: [site]/api/device/meteo-last/ | ||
− | + | request parameters: | |
(string) token, | (string) token, | ||
Строка 836: | Строка 840: | ||
(int) device_id | (int) device_id | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 845: | Строка 850: | ||
response: | response: | ||
− | + | response parameters: (object) | |
− | + | Example response: | |
<pre> | <pre> | ||
Строка 866: | Строка 871: | ||
</pre> | </pre> | ||
− | == | + | == Receiving meteorological data for the period == |
+ | |||
request: | request: | ||
Request URL: [site]/api/device/meteo-period/ | Request URL: [site]/api/device/meteo-period/ | ||
− | + | request parameters: | |
(string) token, | (string) token, | ||
Строка 879: | Строка 885: | ||
(int) period | (int) period | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
"token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", | "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", | ||
"device_id": 130, | "device_id": 130, | ||
− | "period": 1 // | + | "period": 1 // number of days |
} | } | ||
</pre> | </pre> | ||
Строка 890: | Строка 897: | ||
response: | response: | ||
− | + | response parameters: (array to objects) | |
− | + | Example response: | |
+ | |||
<pre> | <pre> | ||
[ | [ | ||
Строка 917: | Строка 925: | ||
</pre> | </pre> | ||
− | == | + | == Receive power data (last) == |
request: | request: | ||
+ | |||
Request URL: [site]/api/device/electro-last/ | Request URL: [site]/api/device/electro-last/ | ||
− | + | request parameters: | |
(string) token, | (string) token, | ||
Строка 928: | Строка 937: | ||
(int) device_id | (int) device_id | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 938: | Строка 948: | ||
response: | response: | ||
− | + | response parameters: (object) | |
− | + | Example response: | |
<pre> | <pre> | ||
Строка 962: | Строка 972: | ||
</pre> | </pre> | ||
− | == | + | == Obtain power data for a period (period) == |
− | + | ||
request: | request: | ||
Request URL: [site]/api/device/electro-period/ | Request URL: [site]/api/device/electro-period/ | ||
− | + | request parameters: | |
(string) token, | (string) token, | ||
Строка 976: | Строка 986: | ||
(int) period | (int) period | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 986: | Строка 997: | ||
response: | response: | ||
− | + | response parameters: (array to objects) | |
− | + | Sample answer: | |
<pre> | <pre> | ||
Строка 1017: | Строка 1028: | ||
</pre> | </pre> | ||
− | == | + | == Getting data about third-party devices (other-last) == |
− | + | The method returns information about the last detected third-party device. | |
− | + | ||
request: | request: | ||
Request URL: [site]/api/device/other-last/ | Request URL: [site]/api/device/other-last/ | ||
− | + | Request parameters: | |
(string) token, | (string) token, | ||
Строка 1031: | Строка 1042: | ||
(int) device_id | (int) device_id | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1040: | Строка 1052: | ||
response: | response: | ||
− | + | response parameters: (object) | |
+ | |||
+ | Example response: | ||
− | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1062: | Строка 1075: | ||
− | == | + | == Get data on third-party devices for the period (other-period) == |
request: | request: | ||
Request URL: [site]/api/device/other-period/ | Request URL: [site]/api/device/other-period/ | ||
− | + | request parameters: | |
(string) token, | (string) token, | ||
Строка 1075: | Строка 1088: | ||
(int) period | (int) period | ||
− | + | Request example: | |
+ | |||
{ | { | ||
"token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", | "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", | ||
"device_id": 118, | "device_id": 118, | ||
− | "period": 1 // | + | "period": 1 // number of days |
} | } | ||
response: | response: | ||
− | + | response parameters: (array to objects) | |
+ | |||
+ | Example response: | ||
− | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1109: | Строка 1124: | ||
</pre> | </pre> | ||
− | = Wizard | + | = Devices adding Wizard = |
− | == | + | == Door open sensor (create-door-open-sensor) == |
URL: [site]/api/wizard/create-door-open-sensor | URL: [site]/api/wizard/create-door-open-sensor | ||
− | + | Parameters: | |
controller_id (required): int | controller_id (required): int | ||
token (required): string, 64 | token (required): string, 64 | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_ready (optional): string, 64 // | + | code_ready (optional): string, 64 //Readiness code name |
− | code_alarm (optional): string, 64 // | + | code_alarm (optional): string, 64 //Alert code name |
− | code_low_battery (optional): string, 64 // | + | code_low_battery (optional): string, 64 //Name of low battery code |
RESPONSE: | RESPONSE: | ||
Строка 1134: | Строка 1149: | ||
</pre> | </pre> | ||
− | + | After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes. | |
− | == | + | == Flood sensor (create-flood-sensor) == |
Request URL: [site]/api/wizard/create-flood-sensor | Request URL: [site]/api/wizard/create-flood-sensor | ||
Строка 1148: | Строка 1163: | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_alarm (optional): string, 64 // | + | code_alarm (optional): string, 64 //Alert code name |
− | code_tamper (optional): string, 64 // | + | code_tamper (optional): string, 64 //Intervention code name |
− | code_low_battery (optional): string, 64 // | + | code_low_battery (optional): string, 64 //Name of low battery code |
RESPONSE: | RESPONSE: | ||
Строка 1164: | Строка 1179: | ||
</pre> | </pre> | ||
--------------------------------------- | --------------------------------------- | ||
− | + | After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes. | |
− | == | + | == Remote, 4 buttons (create-console) == |
Request URL: [site]/api/wizard/create-console | Request URL: [site]/api/wizard/create-console | ||
Строка 1179: | Строка 1194: | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_lock (optional): string, 64 // | + | code_lock (optional): string, 64 //Lock code name |
− | code_unlock (optional): string, 64 // | + | code_unlock (optional): string, 64 //Unlock code name |
− | code_s (optional): string, 64 // | + | code_s (optional): string, 64 //"s" code name |
− | code_alarm (optional): string, 64 // | + | code_alarm (optional): string, 64 //Alert code name |
RESPONSE: | RESPONSE: | ||
Строка 1197: | Строка 1212: | ||
</pre> | </pre> | ||
--------------------------------------- | --------------------------------------- | ||
− | + | After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes. | |
− | == | + | == Siren (create-siren) == |
Request URL: [site]/api/wizard/create-siren | Request URL: [site]/api/wizard/create-siren | ||
Строка 1212: | Строка 1227: | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_on (optional): string, 64 // | + | code_on (optional): string, 64 //Name of the inclusion code |
− | code_off (optional): string, 64 // | + | code_off (optional): string, 64 //Shutdown code name |
− | code_blank (optional): string, 64 // | + | code_blank (optional): string, 64 // blank code name |
RESPONSE: | RESPONSE: | ||
Строка 1228: | Строка 1243: | ||
</pre> | </pre> | ||
--------------------------------------- | --------------------------------------- | ||
− | + | Before sending the parameters, it is necessary to transfer the siren to the training mode | |
− | == | + | == Weather Station: Get a list of weather stations found in the last 10 minutes (get-meteos) == |
+ | |||
Request URL: [site]/api/wizard/get-meteos | Request URL: [site]/api/wizard/get-meteos | ||
Строка 1248: | Строка 1264: | ||
</pre> | </pre> | ||
− | == | + | == Adding Weather Station (create-meteo) == |
Request URL: [site][site]/api/wizard/create-meteo | Request URL: [site][site]/api/wizard/create-meteo | ||
Строка 1258: | Строка 1274: | ||
token (required): string, 64 | token (required): string, 64 | ||
− | meteo_num (required): int // | + | meteo_num (required): int //It turns out in the list above |
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
Строка 1274: | Строка 1290: | ||
− | == | + | == Water tap == |
− | + | The procedure for adding a crane: | |
− | 1) | + | 1) Generate codes |
− | 2) | + | 2) Press the button on the tap until the tap flashes three times. |
− | 3) | + | 3) Send one code |
− | 4) | + | 4) Press the button on the tap once |
− | 5) | + | 5) Press the button on the tap until it blinks 4 times |
− | 6) | + | 6) Send the second code from the generated |
− | 7) | + | 7) Press the button on the tap once |
− | 8) | + | 8) Send a request to create a crane. |
− | === | + | === Code Generation === |
Request URL: [site]/api/wizard/create-codes | Request URL: [site]/api/wizard/create-codes | ||
Строка 1314: | Строка 1330: | ||
− | === | + | === Code Execution === |
Request URL: [site]/api/wizard/execute-code | Request URL: [site]/api/wizard/execute-code | ||
Строка 1324: | Строка 1340: | ||
token (required): string, 64 | token (required): string, 64 | ||
− | code (required): int // | + | code (required): int // Takes from generated |
Response: | Response: | ||
Строка 1336: | Строка 1352: | ||
</pre> | </pre> | ||
− | === | + | === Adding a tap === |
Request URL: [site]/api/wizard/create-crane-by-codes | Request URL: [site]/api/wizard/create-crane-by-codes | ||
Строка 1352: | Строка 1368: | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_open (optional): string, 64 // | + | code_open (optional): string, 64 //The name of the opening code |
− | code_close (optional): string, 64 // | + | code_close (optional): string, 64 //Closing code name |
RESPONSE: | RESPONSE: | ||
Строка 1364: | Строка 1380: | ||
</pre> | </pre> | ||
− | + | Название кода закрытия | |
− | + | The procedure for adding the socket is as follows: | |
− | 1) | + | 1) Generate codes |
− | 2) | + | 2) Press the button on the outlet until it flashes |
− | 3) | + | 3) Send one code |
+ | |||
+ | 4) Press the button on the outlet until it flashes | ||
4) Зажать на розетке кнопку, пока она не начнет мигать | 4) Зажать на розетке кнопку, пока она не начнет мигать | ||
− | + | 6) Send a request to create an outlet | |
− | |||
− | 6) | ||
− | === | + | === Generation of codes (create-codes) === |
Request URL: [site]/api/wizard/create-codes | Request URL: [site]/api/wizard/create-codes | ||
Строка 1404: | Строка 1420: | ||
− | === | + | === Code Execution (execute-code) === |
Request URL: [site]/api/wizard/execute-code | Request URL: [site]/api/wizard/execute-code | ||
Строка 1414: | Строка 1430: | ||
token (required): string, 64 | token (required): string, 64 | ||
− | code (required): int // | + | code (required): int // Takes from generated |
Response | Response | ||
Строка 1425: | Строка 1441: | ||
− | === | + | === Add a socket (create-socket) === |
Request URL: [site]/api/wizard/create-socket | Request URL: [site]/api/wizard/create-socket | ||
Строка 1441: | Строка 1457: | ||
device_name (optional): string, 256 | device_name (optional): string, 256 | ||
− | code_off (optional): string, 64 // | + | code_off (optional): string, 64 //Shutdown Code Name |
− | code_on (optional): string, 64 // | + | code_on (optional): string, 64 //Name of the inclusion code |
RESPONSE: | RESPONSE: | ||
Строка 1453: | Строка 1469: | ||
</pre> | </pre> | ||
− | = | + | = Scripts = |
− | == | + | == List of scripts (list) == |
request: | request: | ||
Request URL: [site]/api/scheduler/list/ | Request URL: [site]/api/scheduler/list/ | ||
− | + | request parameters: (string) token | |
− | + | Request example: | |
<pre> | <pre> | ||
Строка 1472: | Строка 1488: | ||
response: | response: | ||
− | + | response parameters: | |
+ | |||
+ | Example response: | ||
− | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1529: | Строка 1546: | ||
− | == | + | == Update Scripts (update) == |
− | + | The request is carried out in 2 stages: in the first stage it occurs when a request is made to update the Controller (see "Updating the Controller"); | |
− | + | at the second stage, information about each action is updated. | |
request: | request: | ||
Request URL: [site]/api/scheduler/update/ | Request URL: [site]/api/scheduler/update/ | ||
− | + | request parameters: | |
(int) controller_id, | (int) controller_id, | ||
Строка 1543: | Строка 1560: | ||
(string) token | (string) token | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1553: | Строка 1571: | ||
response: | response: | ||
− | + | response parameters: | |
− | + | Example response: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1561: | Строка 1580: | ||
} | } | ||
</pre> | </pre> | ||
− | |||
+ | The update process happens automatically. To get the result, a timeout is required, after which a standard data request is made (controller, actions) | ||
− | == | + | |
+ | == Script Information (info) == | ||
request: | request: | ||
Request URL: [site]/api/scheduler/info/ | Request URL: [site]/api/scheduler/info/ | ||
− | + | request parameters: | |
(int) scheduler_id, | (int) scheduler_id, | ||
Строка 1575: | Строка 1595: | ||
(string) token | (string) token | ||
− | + | Example response: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1584: | Строка 1605: | ||
response: | response: | ||
− | + | response parameters: | |
− | + | Example response: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1634: | Строка 1656: | ||
− | = | + | = User logs (logs) = |
+ | |||
request: | request: | ||
Request URL: [site]/api/profile/logs/ | Request URL: [site]/api/profile/logs/ | ||
− | + | request parameters: (string) token | |
+ | |||
+ | Request example: | ||
− | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1647: | Строка 1671: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
response: | response: | ||
− | + | ||
− | + | response parameters: (object) | |
+ | example: | ||
{ | { | ||
Строка 1659: | Строка 1685: | ||
− | = | + | = Codes = |
− | == | + | == Getting code info (info) == |
request: | request: | ||
Строка 1667: | Строка 1693: | ||
Request URL: [site]/api/property/info/ | Request URL: [site]/api/property/info/ | ||
− | + | request parameters: | |
(int) controller_id, | (int) controller_id, | ||
Строка 1676: | Строка 1702: | ||
(string) token | (string) token | ||
− | + | Request example: | |
+ | |||
<pre> | <pre> | ||
{ | { | ||
Строка 1688: | Строка 1715: | ||
response: | response: | ||
− | + | response parameters: | |
− | + | Example response: | |
<pre> | <pre> | ||
{ | { | ||
Строка 1713: | Строка 1740: | ||
− | == | + | == Change code name (update-code-name) == |
Request URL: [site]/api/device/update-code-name | Request URL: [site]/api/device/update-code-name | ||
Строка 1735: | Строка 1762: | ||
</pre> | </pre> | ||
− | == | + | == Receiving codes by signal type (get-codes-by-subtype) == |
Request URL: [site]/api/device/get-codes-by-subtype | Request URL: [site]/api/device/get-codes-by-subtype | ||
Строка 1745: | Строка 1772: | ||
device_subtype_id (optional): int, default 0. | device_subtype_id (optional): int, default 0. | ||
− | == | + | == Getting a list of codes (get-codes) == |
Request URL: [site]/api/device/get-codes | Request URL: [site]/api/device/get-codes | ||
Строка 1864: | Строка 1891: | ||
</pre> | </pre> | ||
− | == | + | == Adding code to a device (set-code-to-device) == |
Request URL: [site]/api/device/set-code-to-device | Request URL: [site]/api/device/set-code-to-device | ||
Строка 1895: | Строка 1922: | ||
</pre> | </pre> | ||
− | == | + | == Remove code (remove-code) == |
Request URL: [site]/api/device/remove-code | Request URL: [site]/api/device/remove-code | ||
Строка 1914: | Строка 1941: | ||
</pre> | </pre> | ||
− | = | + | = Events = |
− | == | + | == Press the button on the device (event) == |
request: | request: | ||
Request URL: [site]/api/device/event/ | Request URL: [site]/api/device/event/ | ||
− | + | ||
+ | request parameters: | ||
(string) controller_name, | (string) controller_name, | ||
Строка 1933: | Строка 1961: | ||
(int) device_type | (int) device_type | ||
− | + | Request example: | |
<pre> | <pre> | ||
Строка 1945: | Строка 1973: | ||
</pre> | </pre> | ||
− | + | since MQTT is one-way, there can be no answer. An answer may be returned that the request has been sent: | |
+ | |||
response: | response: | ||
− | + | response parameters: | |
− | + | Sample answer: | |
<pre> | <pre> | ||
Строка 1958: | Строка 1987: | ||
</pre> | </pre> | ||
− | = | + | = Places = |
− | == | + | == Getting a list of places (places-list) == |
Request URL: [site]/api/places/places-list | Request URL: [site]/api/places/places-list | ||
Строка 1979: | Строка 2008: | ||
− | == | + | == Creating a place (create) == |
Строка 1990: | Строка 2019: | ||
root (optional): int, default 1 | root (optional): int, default 1 | ||
− | lft (optional): int, from 1 to 5 // | + | lft (optional): int, from 1 to 5 //Summ of rgt should be 5 |
− | rgt (optional): int, from 1 to 5 // | + | rgt (optional): int, from 1 to 5 //Summ of lft should be 5 |
lvl (optional): int, default 0 | lvl (optional): int, default 0 | ||
Строка 1998: | Строка 2027: | ||
name (optional): string, 64, default 'Simple name' | name (optional): string, 64, default 'Simple name' | ||
− | icon (optional): string, default '' // | + | icon (optional): string, default '' //Valid parameters are keys that are presented above |
− | color (optional): string, default: '#ccc' // | + | color (optional): string, default: '#ccc' //Any color in HEX format, the grid at the beginning is required |
active (optional): int, default 1 | active (optional): int, default 1 | ||
Строка 2038: | Строка 2067: | ||
− | == | + | == Editing a place (edit) == |
Request URL: [site]/api/places/edit | Request URL: [site]/api/places/edit | ||
Строка 2050: | Строка 2079: | ||
root (optional): int, default 1 | root (optional): int, default 1 | ||
− | lft (optional): int, from 1 to 5 // | + | lft (optional): int, from 1 to 5 //Summ of rgt should be 5 |
− | rgt (optional): int, from 1 to 5 // | + | rgt (optional): int, from 1 to 5 //Summ of lft should be 5 |
lvl (optional): int, default 0 | lvl (optional): int, default 0 | ||
Строка 2058: | Строка 2087: | ||
name (optional): string, 64, default 'Simple name' | name (optional): string, 64, default 'Simple name' | ||
− | icon (optional): string, default '' // | + | icon (optional): string, default '' //Allowed parameters as object keys are presented above |
− | color (optional): string, default: '#ccc' // | + | color (optional): string, default: '#ccc' //Any color in HEX format, the grid at the beginning is required |
active (optional): int, default 1 | active (optional): int, default 1 | ||
Строка 2098: | Строка 2127: | ||
</pre> | </pre> | ||
− | == | + | == Deleting a place (delete) == |
Request URL: [site]/api/places/delete | Request URL: [site]/api/places/delete | ||
Строка 2120: | Строка 2149: | ||
− | == | + | == Ebus subscription activation == |
− | + | Getting the subscription status on the Controller - “in/subscription/get”: | |
<pre> | <pre> | ||
{ | { | ||
− | "id": 1, // ID | + | "id": 1, // Subscription ID (see below) |
"seq_id": 0 | "seq_id": 0 | ||
} | } | ||
</pre> | </pre> | ||
− | + | Response: | |
<pre> | <pre> | ||
{ | { | ||
"seq_id": 0, | "seq_id": 0, | ||
− | "remain_time": 100, // | + | "remain_time": 100, // remaining time in seconds; 4294967295 is unlimited |
"success": 0/1 | "success": 0/1 | ||
} | } | ||
</pre> | </pre> | ||
− | + | Subscription setting on the Controller - “in/subscription/set”: | |
<pre> | <pre> | ||
{ | { | ||
"seq_id": 0, | "seq_id": 0, | ||
− | "id": 1, // ID | + | "id": 1, // Subscription ID (see below) |
− | "remain_time": 100 // | + | "remain_time": 100 // Remaining time in seconds; 4294967295 is unlimited |
} | } | ||
</pre> | </pre> | ||
− | + | Response: | |
<pre> | <pre> | ||
{ | { | ||
Строка 2160: | Строка 2189: | ||
</pre> | </pre> | ||
− | + | Subscription IDs: | |
SUBSCRIPTION_EBUS = 1 | SUBSCRIPTION_EBUS = 1 | ||
− | + | Controller Status | |
− | + | The Controller sends information about its online/offline status to the “out/status” topic. | |
− | + | Request format: | |
<pre> | <pre> | ||
{ | { | ||
− | "status": 1 // | + | "status": 1 // see below |
} | } | ||
</pre> | </pre> | ||
− | + | The “status” field can have the following values: | |
− | • "0" | + | • "0" - offline |
− | • "1" | + | • "1" - online |
− | • "2" | + | • "2" - online after power on |
− | + | When receiving a message with the status "2", the portal should send information about user subscriptions to the Controller, as described in the "Subscriptions" section. | |
− | = | + | = Errors = |
− | + | error parameters: | |
− | |||
− | |||
<pre> | <pre> |
Текущая версия на 15:04, 29 марта 2019
- API v01 *
API ( json )
Содержание
- 1 Account
- 2 Controllers
- 2.1 List of User Controllers (list)
- 2.2 Controller Information (info)
- 2.3 Arming / disarming the Controller (armed)
- 2.4 Add Controller (add)
- 2.5 Update controller status (update-status)
- 2.6 Getting the current status of the Controller (get-status)
- 2.7 Transmit Local IP Controller (get-ip)
- 2.8 Setting a Subscription on the Controller
- 2.9 View Subscription Status (get-subscribe-status)
- 2.10 Activation / extension / purchase of a subscription (set-subscribe)
- 2.11 Getting phone list (get-phones)
- 2.12 Edit phone (edit-phone)
- 2.13 Delete phone (delete-phone)
- 2.14 Add Phone (add-phone)
- 3 Devices
- 3.1 Getting a list of user devices (list)
- 3.2 Device Information (info)
- 3.3 Update Device Information (update)
- 3.4 Deleting a device (delete)
- 3.5 Getting weather data (last)
- 3.6 Receiving meteorological data for the period
- 3.7 Receive power data (last)
- 3.8 Obtain power data for a period (period)
- 3.9 Getting data about third-party devices (other-last)
- 3.10 Get data on third-party devices for the period (other-period)
- 4 Devices adding Wizard
- 5 Scripts
- 6 User logs (logs)
- 7 Codes
- 8 Events
- 9 Places
- 10 Errors
Account
Login
request:
Request URL: [site]/api/login
request parameters:
(string) email,
(string) password
Request example:
{ "email":"aaaa@aaaa.aa", "password":"12345678" } response: response parameters: (object) Response sample: <pre> { "user_id":1, "username":"Ivan Pupkin", "email":"aaaa@aaa.aa", "phone": "423546546546", "sex":2, // 0 - not specified , 1 - female , 2 - male "country":219, // country code in database "active_configuration":"1", "refcode":"JHE-1GD-T8B-9HB", "status":10, // 0 - inactive, 10 - active "token":"1Cyuvr9DKMbB6aFQ-mLPLeGZXFLyuK8d", "expired":1502586831 // timestamp to which token is active }
Registration
request: Request URL: [site]/api/registration
request parameters:
(string) email,
(string) password
Request example:
{ "email":"aaaa@aaaa.aa", "password":"12345678" }
response: параметры ответа: (object) пример:
{ "user_id": 43, "username": "user_4383", "email": "aaaa@aaa.aa", "sex": null, "country": null, "active_configuration": null, "refcode": "746-81O-0RJ-RJS", "status": 10 }
User Profile (profile)
request:
Request URL: [site]/api/profile/
request parameters: (string) token
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response: параметры ответа: (object) пример:
{ "user_id":1, "username":"Ivan Pupkin", "email":"aaaa@aaa.aa", "phone": "423546546546", "sex":2, // пол 0 - не указан , 1 - женский , 2 - мужской "send_email": 1, "send_sms": 0, "role": 1, "lang": 2, "country":219, // код страны в базе "active_configuration":"1", "refcode":"JHE-1GD-T8B-9HB", "status":10, // 0 - неактивен , 10 - активен "token":"1Cyuvr9DKMbB6aFQ-mLPLeGZXFLyuK8d", }
Controllers
List of User Controllers (list)
request: Request URL: [site]/api/ctrl/list/
request parameters: (string) token
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters: (array)
Sample answer:
{ "0":{ "id":"11", "name":"AS_A61301A020E4", "armed":"0", //0 - disarmed, 1 - under guard "device_ids":"a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}", //ids of devices on the Controller "action_ids":"a:0:{}", //ids of actions on the Controller "timezone":"3", "token":"747D3844ABD35B08F27D18D15D7178B7AF99A754D805633928D4362D19B4AEC2", "online":"1" }, "1":{ "id":"12", "name":"AS_A61301A020E5", "armed":"1", "device_ids":"a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}", "action_ids":"a:0:{}", "timezone":"2", "token":"734D3844ABD35B08F27D18D15D7178B7AF99A754D805633928D4362D19B4AEC2", "online":"0" }]
Controller Information (info)
request: Request URL: [site]/api/ctrl/info/
request parameters:
- (int) controller_id,
- (string) token
Request example:
{ "controller_id": 1 , "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters: (object)
response parameters: (object)
{ "id":"6", "name":"AS_7F26335CCF4B", "armed":"1", "device_ids":"a:26:{i:0;i:25;i:1;i:26;i:2;i:28;i:3;i:19;i:4;i:40;i:5;i:41;i:6;i:42;i:7;i:43;i:8;i:36;i:9;i:34;i:10;i:29;i:11;i:45;i:12;i:38;i:13;i:33;i:14;i:30;i:15;i:31;i:16;i:49;i:17;i:24;i:18;i:46;i:19;i:47;i:20;i:44;i:21;i:27;i:22;i:22;i:23;i:9;i:24;i:23;i:25;i:7;}", "action_ids":"a:4:{i:0;i:45;i:1;i:46;i:2;i:49;i:3;i:42;}", "timezone":"3", "token":"660D91C2B0926A8C981AE7DA4AAA4421A3D86D136262A6F8E98ACF534A7A715B", "online":"1" }
Arming / disarming the Controller (armed)
request:
Request URL: [site]/api/ctrl/armed/
request parameters:
- (int) controller_id,
- (string) token
example:
{ "controller_id": 6 , "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
Since MQTT is one-way, there can be no answer. Answer that the request is gone as follows:
Response:
Example:
{ "result": "Ok" }
Add Controller (add)
request:
Request URL: [site]/api/ctrl/add
request parameters: (string) token
Example
{ "token": "_ zcX0_QceAqgP_seIvjG32EC3HMO34ae" } </ pre> Response: Example: <pre> { "PIN": "7gDH" } </ pre> After entering the PIN code, you need to update the list of Controllers (/ api / ctrl / list /) == Update the list of devices and actions on the controller (update) == === Stage 1 - update the list of IDS devices on the controller === Request: Request URL: [site]/api/ctrl/update/ Request parameters: #(int) controller_id, #(string) token example: <pre> { "controller_id": 6, "token": "_ zcX0_QceAqgP_seIvjG32EC3HMO34ae" } </ pre> Response: Example: <pre> { "result": "Ok" // "Ok" = request was sent } </ pre> === Stage 2 - the update information about each device === request: Request URL: [site]/api/ctrl/update-devices/ request parameters: (int) controller_id, (string) token Request example: <pre> { "controller_id": 6 , "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", }
response:
response parameters:
Sample answer:
{ "result": "Ok" // answer that the request is gone } </ pre> The process takes place automatically. To obtain the result, a timeout is required, after which a standard request is made to receive data (controller, devices) == Delete Controller (delete) == Request URL: [site]/api/ctrl/delete Request parameters: Request example: <pre> { "token": "8yE-VIQrYuZ2bTeho_lajxjOJPnIe_Yx", "controller_id": "81" }
response:
example:
{ "error": null, "data": {"resuls": "Ok"} }
Update controller status (update-status)
request:
Request URL: [site]/api/ ctrl/update-status/
Request parameters:
(string) token,
(int) controller_id
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "controller_id": 122 }
response:
response parameters:
Sample answer:
{ "error":null, "data":{ "resuls":"Ok" } }
Getting the current status of the Controller (get-status)
request:
Request URL: [site]/api/ ctrl/get-status/
request parameters
(string) token,
(int) controller_id
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "controller_id": 122 }
response:
response parameters:
Sample answer:
{ "error":null, "data":{ "status":1 } }
The “status” field can have the following values: • 0 - offline
• 1 - online
• 2 - online after power on
Transmit Local IP Controller (get-ip)
Request URL: [site]/api/ctrl/get-ip
Request Params:
token (required): string(64);
controller_id (required): int;
SUCCESS RESPONSE:
{ data:'192.168.0.15', error: null }
Setting a Subscription on the Controller
in/subscription/set
Request URL: [site]/in/subscription/set”
{ "seq_id": 0, "id": 1, // Subscription ID (see below) "remain_time": 100 // remaining time in seconds, 4294967295 - unlimited }
View Subscription Status (get-subscribe-status)
Request URL: [site]/api/ctrl/get-subscribe-status
params:
token (required): string(64)
controller_id (required): int
response:
{data:{id: 1, controller_id: 40, user_id: 424, remain_time: 100, request_time: 1355314332, response_time: 1355315332, success: 0}, error: }
Activation / extension / purchase of a subscription (set-subscribe)
Request URL: [site]/api/ctrl/set-subscribe
params:
token (required): string(64)
controller_id (required): int
response:
{ data:{ id: 1, controller_id: 40, user_id: 424, remain_time: 100, request_time: 1355314332, response_time: 1355315332, success: 0 }, error: '' }
Getting phone list (get-phones)
Request URL: [site]/api/ctrl/get-phones
Params:
token (required): string, 64
controller_id (required): int
type (optional): string, range ['recipient', 'authorized', 'all'], default 'all'
Response:
{ 'error': null, data: [ {'id': 5, 'phone': '+380123456789'}, {'id': 6, 'phone': '+380123334455'}, {'id': 7, 'phone': '+380112223344'} ] }
Edit phone (edit-phone)
Request URL: [site]/api/ctrl/edit-phone
Params:
token (required): string, 64
phone_id (required): int
is_recipient (optional): int
is_authorized (optional): int
phone (optional): string
Response:
{ "error":null, "data":{ "id":2, "controller_id":81, "phone":"+380503334455", "is_recipient":"1", "is_authorized":0 } }
Delete phone (delete-phone)
Request URL: [site]/api/ctrl/delete-phone
Params:
token (required): string, 64
phone_id (required): int
Response:
{ "error":null, "data":{"response":"OK"} }
Add Phone (add-phone)
Request URL: [site]/api/ctrl/add-phone
Params:
token (required): string, 64
controller_id (required): int
phone (required): string
is_recipient (optional): int
is_authorized (optional): int
Response:
{ "error":null, "data":{ "id":2, "controller_id":81, "phone":"+380503334455", "is_recipient":"1", "is_authorized":0 } }
Devices
Getting a list of user devices (list)
request:
Request URL: [site]/api/device/list
request parameters: (int) controller_id, (string) token
Request example:
{ "controller_id": 1 , "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response: Sample answer:
{ "0":{ "id":"122", "external_id":"19", // id at the Controller "controller_id":"6", "name":"Сирена", "type_id":"2", //device type "codes":":{ //codes (buttons) "0":{ "id":"218", "external_cod_id":"32", "device_id":"122", "name":"ON", "code":"3675192", "protocol":"1", "pulse_len":null, "group_1":"1", "group_2":"0", "group_3":"0", "group_4":"0", "group_5":"0", "group_6":"0", "group_7":"0", "group_8":"0", "active":"1" }, "1":{ ... } }, "state":"1", "on_dashboard":"1", //show at Homepage "active":"1" }, "1":{ "id":"120", "external_id":"22", "controller_id":"6", "name":"XXXXXX", "type_id":"3", "codes": ... , "state":"1", "on_dashboard":"0", "active":"1" } }
Device Information (info)
request:
Request URL: [site]/api/device/info/
request parameters:
(int) controller_id,
(int) device_id,
(string) token
Request example:
{ "controller_id": 1 , "device_id": 122, "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters: Sample answer:
{ "id":"122", "external_id":"19", "controller_id":"6", "name":"Сирена", "type_id":"2", "codes":{ "0":{ "id":"218", "external_cod_id":"32", "device_id":"122", "name":"ON", "code":"3675192", "protocol":"1", "pulse_len":null, "group_1":"1", "group_2":"0", "group_3":"0", "group_4":"0", "group_5":"0", "group_6":"0", "group_7":"0", "group_8":"0", "active":"1" }, "1":{ "id":"219", "external_cod_id":"33", "device_id":"122", "name":"OFF", "code":"3675186 ... } }, "state":"1", "on_dashboard":"1", "active":"1" }
Update Device Information (update)
request:
Request URL: [site]/api/device/update/
параметры запроса:
(int) device_id,
(string) name,
(int) active,
(string) token,
Request example:
{ "device_id": 107, // local device id "name": "New name", // new name "active": 1, "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters: Sample answer:
{ "resuls" : "Ok" }
Deleting a device (delete)
request:
Request URL: [site]/api/device/delete/
request parameters:
(int) device_id,
(string) token
Request example:
{ "device_id": 107, // local device id "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
Parameters of the answer:
Sample answer:
{ "resuls" : "Ok" }
Getting weather data (last)
request: Request URL: [site]/api/device/meteo-last/
request parameters:
(string) token,
(int) device_id
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 130 }
response:
response parameters: (object)
Example response:
{ "id":"4046", "controller_name":"AS_7FD6785CCF5D", "internal_id":"55", "device_id":"130", "name":"7", "temp":"240", "hum":"245", "illum":"0", "pres":"1239", "volt":"32", "date_time":"2016-03-02 21:09:40", "new":"0" }
Receiving meteorological data for the period
request:
Request URL: [site]/api/device/meteo-period/
request parameters:
(string) token,
(int) device_id,
(int) period
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 130, "period": 1 // number of days }
response:
response parameters: (array to objects)
Example response:
[ { "id":"4065", "controller_name":"AS_7FD6785CCF5D", "internal_id":"55", "device_id":"130", "name":"7", "temp":"240", "hum":"523", "illum":"0", "pres":"1239", "volt":"32", "date_time":"2017-07-30 21:11:07", "new":"0" }, { "id":"4067", "controller_name":"AS_7FD6785CCF5D ... }, ]
Receive power data (last)
request:
Request URL: [site]/api/device/electro-last/
request parameters:
(string) token,
(int) device_id
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 130 }
response:
response parameters: (object)
Example response:
{ "id":"318", "controller_id":"11", "external_id":"2", "device_id":"125", "name":"23", "token":"747D3844ABD35B08F27D18D15D7178B7AF99A754D805633928D4362D19B4AEC2", "last_seen":"2017-07-21 04:20:27", "available":"1", "voltage":"24", "have_voltage":"1", "current":"2147483647", "have_current":"1", "supp_voltage":"33", "date_create":"2017-07-21 01:20:33", "new":"0" }
Obtain power data for a period (period)
request:
Request URL: [site]/api/device/electro-period/
request parameters:
(string) token,
(int) device_id,
(int) period
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 130, "period": 1 // количество дней }
response:
response parameters: (array to objects)
Sample answer:
[ { "id":"318", "controller_id":"11", "external_id":"2", "device_id":"125", "name":"23", "token":"747D3844ABD35B08F27D18D15D7178B7AF99A754D805633928D4362D19B4AEC2", "last_seen":"2017-07-21 04:20:27", "available":"1", "voltage":"24", "have_voltage":"1", "current":"2147483647", "have_current":"1", "supp_voltage":"33", "date_create":"2017-07-21 01:20:33", "new":"0" }, { "id":"318", "controller_id":"11", ... }, ]
Getting data about third-party devices (other-last)
The method returns information about the last detected third-party device. request:
Request URL: [site]/api/device/other-last/
Request parameters:
(string) token,
(int) device_id
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 118 }
response:
response parameters: (object)
Example response:
{ "id":"1301", "controller_id":"6", "device_id":"118", "name":"Розетка", "code":"81", "pulse_len":null, "bit_len":null, "protocol":null, "groups":null, "type":null, "date_time":"2017-08-21 04:55:18", "active":null, "new":"1" }
Get data on third-party devices for the period (other-period)
request:
Request URL: [site]/api/device/other-period/
request parameters:
(string) token,
(int) device_id,
(int) period
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", "device_id": 118, "period": 1 // number of days } response:
response parameters: (array to objects)
Example response:
{ "id":"1301", "controller_id":"6", "device_id":"118", "name":"Розетка", "code":"81", "pulse_len":null, "bit_len":null, "protocol":null, "groups":null, "type":null, "date_time":"2017-08-21 04:55:18", "active":null, "new":"1" }, { "id":"4067", "controller_id":"6", ... }
Devices adding Wizard
Door open sensor (create-door-open-sensor)
URL: [site]/api/wizard/create-door-open-sensor
Parameters: controller_id (required): int token (required): string, 64 device_name (optional): string, 256 code_ready (optional): string, 64 //Readiness code name code_alarm (optional): string, 64 //Alert code name code_low_battery (optional): string, 64 //Name of low battery code
RESPONSE:
{ data:{ 'response': 'OK' }, error: null }
After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes.
Flood sensor (create-flood-sensor)
Request URL: [site]/api/wizard/create-flood-sensor
Params:
controller_id (required): int
token (required): string, 64
device_name (optional): string, 256 code_alarm (optional): string, 64 //Alert code name
code_tamper (optional): string, 64 //Intervention code name
code_low_battery (optional): string, 64 //Name of low battery code
RESPONSE:
{ data: { 'response': 'OK' }, error: null }
After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes.
Remote, 4 buttons (create-console)
Request URL: [site]/api/wizard/create-console
Params:
controller_id (required): int
token (required): string, 64
device_name (optional): string, 256
code_lock (optional): string, 64 //Lock code name
code_unlock (optional): string, 64 //Unlock code name
code_s (optional): string, 64 //"s" code name
code_alarm (optional): string, 64 //Alert code name
RESPONSE:
{ data: { 'response': 'OK' }, error: null }
After sending the parameters, the added device is expected to be activated. When triggered, the process of adding occurs, and only after that the answer comes.
Siren (create-siren)
Request URL: [site]/api/wizard/create-siren
Params:
controller_id (required): int
token (required): string, 64
device_name (optional): string, 256
code_on (optional): string, 64 //Name of the inclusion code
code_off (optional): string, 64 //Shutdown code name
code_blank (optional): string, 64 // blank code name
RESPONSE:
{ data: { 'response': 'OK' }, error: null }
Before sending the parameters, it is necessary to transfer the siren to the training mode
Weather Station: Get a list of weather stations found in the last 10 minutes (get-meteos)
Request URL: [site]/api/wizard/get-meteos
Params:
controller_id (required): int
token (required): string, 64
RESPONSE:
{ "error":null, "data": [{"id":"93","controller_id":"79","date":"1528389351","type":"7","family":"0","rf_code":null,"rf_bit_len":null,"rf_pulse_len":null,"rf_protocol":null,"rf_freq":null,"ir_code":null,"ir_bit_len":null,"ir_address":null,"ir_protocol":null,"meteo_num":"0"}] }
Adding Weather Station (create-meteo)
Request URL: [site][site]/api/wizard/create-meteo
Params:
controller_id (required): int
token (required): string, 64
meteo_num (required): int //It turns out in the list above
device_name (optional): string, 256
RESPONSE:
{ "error":null, "data":{ "response":"OK" } }
Water tap
The procedure for adding a crane: 1) Generate codes
2) Press the button on the tap until the tap flashes three times.
3) Send one code
4) Press the button on the tap once
5) Press the button on the tap until it blinks 4 times
6) Send the second code from the generated
7) Press the button on the tap once
8) Send a request to create a crane.
Code Generation
Request URL: [site]/api/wizard/create-codes
Params:
controller_id (required): int
token (required): string, 64
Response:
{ "error":null, "data":{"response":{"id":30,"masks":"[6,4,0,1]","code_1":"9920950","code_2":"9920948","code_3":"9920944","code_4":"9920945"} } }
Code Execution
Request URL: [site]/api/wizard/execute-code
Params:
controller_id (required): int
token (required): string, 64
code (required): int // Takes from generated
Response:
{ error: null, data: { "response":"OK" } }
Adding a tap
Request URL: [site]/api/wizard/create-crane-by-codes
Params:
controller_id (required): int
token (required): string, 64
code_1 (required): int
code_2 (required): int
device_name (optional): string, 256
code_open (optional): string, 64 //The name of the opening code
code_close (optional): string, 64 //Closing code name
RESPONSE:
{ data:{'response': 'OK'}, error: null }
Название кода закрытия
The procedure for adding the socket is as follows:
1) Generate codes
2) Press the button on the outlet until it flashes
3) Send one code
4) Press the button on the outlet until it flashes
4) Зажать на розетке кнопку, пока она не начнет мигать
6) Send a request to create an outlet
Generation of codes (create-codes)
Request URL: [site]/api/wizard/create-codes
Params:
controller_id (required): int
token (required): string, 64
socket (required): любое значение.
Response:
{ "error":null, "data":{ "response":{"id":30,"masks":"[257, 258]","code_1":"8737025","code_2":"8737026"} } }
Code Execution (execute-code)
Request URL: [site]/api/wizard/execute-code
Params:
controller_id (required): int
token (required): string, 64
code (required): int // Takes from generated
Response
{ error: null, data: {'response' => 'OK'} }
Add a socket (create-socket)
Request URL: [site]/api/wizard/create-socket
Params:
controller_id (required): int
token (required): string, 64
code_1 (required): int
code_2 (required): int
device_name (optional): string, 256
code_off (optional): string, 64 //Shutdown Code Name
code_on (optional): string, 64 //Name of the inclusion code
RESPONSE:
{ data: {'response':'OK'}, error: null }
Scripts
List of scripts (list)
request: Request URL: [site]/api/scheduler/list/
request parameters: (string) token
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters:
Example response:
{ "0":{ "id":9, "external_id":42, "name":"test_form_web", "operation":"local", "armed":0, "type":"meteo", "action_id":1, "a_controller_id":6, "a_device_id":112, "a_code_id":0, "a_device_external_id":38, "a_armed":0, "a_conf1":0, "a_conf2":0, "a_conf3":0, "a_conf4":0, "a_conf5":0, "a_conf6":0, "a_conf7":0, "a_conf8":0, "target_id":1, "t_controller_id":6, "t_device_id":119, "t_code_id":203, "t_device_external_id":7, "t_armed":0, "t_conf1":0, "t_conf2":0, "t_conf3":0, "t_conf4":0, "t_conf5":0, "t_conf6":0, "t_conf7":0, "t_conf8":0, "date":null, "repetition":"0", "sensor_type":"1", "logic_operation":"=", "value":"3", "active":1 }, "1":{ "id":10, "external_id":45 ... } }
Update Scripts (update)
The request is carried out in 2 stages: in the first stage it occurs when a request is made to update the Controller (see "Updating the Controller"); at the second stage, information about each action is updated.
request: Request URL: [site]/api/scheduler/update/
request parameters:
(int) controller_id,
(string) token
Request example:
{ "controller_id": 6 , "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae", }
response:
response parameters:
Example response:
{ "result": "Ok" // ответ что запрос ушел }
The update process happens automatically. To get the result, a timeout is required, after which a standard data request is made (controller, actions)
Script Information (info)
request: Request URL: [site]/api/scheduler/info/
request parameters:
(int) scheduler_id,
(string) token
Example response:
{ "scheduler_id": 122, "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters:
Example response:
{ "id":9, "external_id":42, "name":"test_form_web", "operation":"local", "armed":0, "type":"meteo", "action_id":1, "a_controller_id":6, "a_device_id":112, "a_code_id":0, "a_device_external_id":38, "a_armed":0, "a_conf1":0, "a_conf2":0, "a_conf3":0, "a_conf4":0, "a_conf5":0, "a_conf6":0, "a_conf7":0, "a_conf8":0, "target_id":1, "t_controller_id":6, "t_device_id":119, "t_code_id":203, "t_device_external_id":7, "t_armed":0, "t_conf1":0, "t_conf2":0, "t_conf3":0, "t_conf4":0, "t_conf5":0, "t_conf6":0, "t_conf7":0, "t_conf8":0, "date":null, "repetition":"0", "sensor_type":"1", "logic_operation":"=", "value":"3", "active":1 }
User logs (logs)
request:
Request URL: [site]/api/profile/logs/
request parameters: (string) token
Request example:
{ "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response:
response parameters: (object) example: {
}
Codes
Getting code info (info)
request:
Request URL: [site]/api/property/info/
request parameters: (int) controller_id,
(int) device_id,
(int) code_id,
(string) token
Request example:
{ "controller_id": 6, "device_id": 109, "code_id": 192, "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
response: response parameters:
Example response:
{ "id":"192", "external_cod_id":"67", "device_id":"109", "name":"4 OFF", "code":"12209156", "protocol":"1", "pulse_len":null, "group_1":"1", "group_2":"0", "group_3":"0", "group_4":"0", "group_5":"0", "group_6":"0", "group_7":"0", "group_8":"0", "active":"1" }
Change code name (update-code-name)
Request URL: [site]/api/device/update-code-name
Request Params:
token (required): string(64)
code_id (required): int
name (optional): string(255)
SUCCESS RESPONSE:
{ data: { 'message': "OK" }, error: null }
Receiving codes by signal type (get-codes-by-subtype)
Request URL: [site]/api/device/get-codes-by-subtype
Request Params:
token (required): string(64)
device_subtype_id (optional): int, default 0.
Getting a list of codes (get-codes)
Request URL: [site]/api/device/get-codes
PARAMS: token (required): string 64
controller_id (required): int
SUCCESS RESPONSE:
{ data: [ { devices: [ { id: 13 external_id: 7, controller_id: 5, name: "Simple device", type_id: 2, password: null, codes: "a:4:{i:0;i:46;i:1;i:47;i:2;i:48;i:3;i:45;}", state: 1, on_dashboard: 0, active: 1, new: 1, family: DEVICE_FAMILY_RADIO, camera_id: null, camera_host: null }, { id: 14 external_id: 8, controller_id: 5, name: "Simple device", type_id: 2, password: null, codes: "a:4:{i:0;i:46;i:1;i:47;i:2;i:48;i:3;i:45;}", state: 1, on_dashboard: 0, active: 1, new: 1, family: DEVICE_FAMILY_RADIO, camera_id: null, camera_host: null }, ], code: { id: 12, controller_id: 5, device_type_id: 2, code: 498654, protocol: 1, bit_len: 32, pulse_len: 86, freq: 77, address: 94, num: 1, date_create: '2018-04-13 18:29:11" } }, { devices: [ { id: 13 external_id: 7, controller_id: 5, name: "Simple device", type_id: 2, password: null, codes: "a:4:{i:0;i:46;i:1;i:47;i:2;i:48;i:3;i:45;}", state: 1, on_dashboard: 0, active: 1, new: 1, family: DEVICE_FAMILY_RADIO, camera_id: null, camera_host: null }, { id: 14 external_id: 8, controller_id: 5, name: "Simple device", type_id: 2, password: null, codes: "a:4:{i:0;i:46;i:1;i:47;i:2;i:48;i:3;i:45;}", state: 1, on_dashboard: 0, active: 1, new: 1, family: DEVICE_FAMILY_RADIO, camera_id: null, camera_host: null }, ], code: { id: 12, controller_id: 5, device_type_id: 2, code: 498654, protocol: 1, bit_len: 32, pulse_len: 86, freq: 77, address: 94, num: 1, date_create: '2018-04-13 18:29:11" } }, }, error: null, }
Adding code to a device (set-code-to-device)
Request URL: [site]/api/device/set-code-to-device
PARAMS:
token (required): string 64
code_id (required): int
device_id (required): int
name (optional): string 256
SUCCESS RESPONSE:
{ data: { id: 5, external_cod_id: 15, device_id: 14, name: "Name" code: 8463517, protocol: 0, pulse_len: 86, active: 1, }, error: null }
Remove code (remove-code)
Request URL: [site]/api/device/remove-code PARAMS:
token (required): string 64
code_id (required): int
SUCCESS RESPONSE:
{ data: { message: "OK" }, error: null }
Events
Press the button on the device (event)
request:
Request URL: [site]/api/device/event/
request parameters:
(string) controller_name,
(int) device_external_id,
(int) cod_external_id,
(string) token,
(int) device_type
Request example:
{ "controller_name": " AS_7F26335CCF4B" , "device_external_id": 19, "cod_external_id": 1, "device_type": 1, "token":"_zcX0_QceAqgP_seIvjG32EC3HMO34ae" }
since MQTT is one-way, there can be no answer. An answer may be returned that the request has been sent:
response:
response parameters:
Sample answer:
{ "result": "Ok" }
Places
Getting a list of places (places-list)
Request URL: [site]/api/places/places-list
Request params:
token (required): string, 64
Response:
{ "error":null, "data":{ "rooms":[{"id":1,"root_id":1,"user_id":424,"lvl":0,"name":"Дом","icon":0,"icon_type":1,"color":"#fff2cc","readonly":0,"visible":1},{"id":2,"root_id":1,"user_id":424,"lvl":1,"name":"Спальня","icon":0,"icon_type":1,"color":"#b6d7a8","readonly":0,"visible":1}] } }
Creating a place (create)
Request URL: [site]/api/places/create
Request params:
token (required): string, 64
root (optional): int, default 1
lft (optional): int, from 1 to 5 //Summ of rgt should be 5
rgt (optional): int, from 1 to 5 //Summ of lft should be 5
lvl (optional): int, default 0
name (optional): string, 64, default 'Simple name'
icon (optional): string, default //Valid parameters are keys that are presented above
color (optional): string, default: '#ccc' //Any color in HEX format, the grid at the beginning is required
active (optional): int, default 1
selected (optional): int, default 0
disabled (optional): int, default 0
readonly (optional): int, default 0
visible (optional): int, default 1
collapsed (optional): int, default 0
movable_u (optional): int, default 1
movable_d (optional): int, default 1
movable_l (optional): int, default 1
movable_r (optional): int, default 1
removable (optional): int, default 1
removable_all (optional): int, default 0
inverse_text (optional): string, default 'black'
Response:
{ error:null, data: {'message': 'OK'} }
Editing a place (edit)
Request URL: [site]/api/places/edit
Request params:
token (required): string, 64
place_id (required): int
root (optional): int, default 1
lft (optional): int, from 1 to 5 //Summ of rgt should be 5
rgt (optional): int, from 1 to 5 //Summ of lft should be 5
lvl (optional): int, default 0
name (optional): string, 64, default 'Simple name'
icon (optional): string, default //Allowed parameters as object keys are presented above
color (optional): string, default: '#ccc' //Any color in HEX format, the grid at the beginning is required
active (optional): int, default 1
selected (optional): int, default 0
disabled (optional): int, default 0
readonly (optional): int, default 0
visible (optional): int, default 1
collapsed (optional): int, default 0
movable_u (optional): int, default 1
movable_d (optional): int, default 1
movable_l (optional): int, default 1
movable_r (optional): int, default 1
removable (optional): int, default 1
removable_all (optional): int, default 0
inverse_text (optional): string, default 'black'
Response:
{ error:null, data: {'message': 'OK'} }
Deleting a place (delete)
Request URL: [site]/api/places/delete
Request params:
token (required): string, 64
place_id (required): int
Response:
{ error:null, data: {'message': 'OK'} }
Ebus subscription activation
Getting the subscription status on the Controller - “in/subscription/get”:
{ "id": 1, // Subscription ID (see below) "seq_id": 0 }
Response:
{ "seq_id": 0, "remain_time": 100, // remaining time in seconds; 4294967295 is unlimited "success": 0/1 }
Subscription setting on the Controller - “in/subscription/set”:
{ "seq_id": 0, "id": 1, // Subscription ID (see below) "remain_time": 100 // Remaining time in seconds; 4294967295 is unlimited }
Response:
{ "seq_id": 0, "success": 0/1 }
Subscription IDs: SUBSCRIPTION_EBUS = 1
Controller Status
The Controller sends information about its online/offline status to the “out/status” topic.
Request format:
{ "status": 1 // see below }
The “status” field can have the following values:
• "0" - offline
• "1" - online
• "2" - online after power on
When receiving a message with the status "2", the portal should send information about user subscriptions to the Controller, as described in the "Subscriptions" section.
Errors
error parameters:
{ "errors":{ "password": [ "Incorrect username." ] } }