API - Power Regulation on Plant
This documentation describes the use of a task named regulation_centrale, as well as the available endpoints for:
- Reading the task and its information.
- Reading the jobs associated with the task.
- Creating a job (execution) of the task.
- Tracking the progress of a job.
1. Read the task
-
Endpoint:
GET https://api.alemca.io/v3/commands/tasks/6cdc1f68-5f44-4ec7-91ad-952d58df6023
Warning
This identifier
6cdc1f68-5f44-4ec7-91ad-952d58df6023
belongs to the Regulation Central task and should not be modified. -
Response (example):
{ "version": 0, "ident": "6cdc1f68-5f44-4ec7-91ad-952d58df6023", "client_root": "xxxxxxxxxxxxx", "created_user": "test@test.com", "update_user": null, "name": "regulation_centrale", "variables_info": { "end_timestamp": { "type": "timestamp", "alias": "End", "description": "End of the regulation period" } }, "comment": "Power regulation on plant", "constants": { "power": "off", "value_on": 1, "length_on": 1, "value_off": 0, "address_on": 40202, "length_off": 1, "address_off": 40202, "slave_id_on": 0, "data_type_on": "uint16", "slave_id_off": 0, "byte_order_on": "AB", "data_type_off": "uint16", "byte_order_off": "AB", "modbus_connectors": "sl1,sl2" }, "active": "True", "script": "regulation_centrale.lua", "created_at": 1740566090, "update_at": 1740566090, "public": true, "hide": false, "allow_offline": true, "notification_mail_list": [] }
2. Read the jobs of the task
-
Endpoint:
GET https://api.alemca.io/v3/commands/tasks/6cdc1f68-5f44-4ec7-91ad-952d58df6023/jobs
Warning
This identifier
6cdc1f68-5f44-4ec7-91ad-952d58df6023
belongs to the Regulation Central task and should not be modified.
3. Create a job (execution) of the task
-
Endpoint:
POST https://api.alemca.io/v3/commands/tasks/6cdc1f68-5f44-4ec7-91ad-952d58df6023/jobs
Warning
This identifier
6cdc1f68-5f44-4ec7-91ad-952d58df6023
belongs to the Regulation Central task and should not be modified. -
Example body:
- Exemple de réponse :
{ "task": { "version": 0, "ident": "6cdc1f68-5f44-4ec7-91ad-952d58df6023", "name": "regulation_centrale" }, "group": null, "ident": "xxxxxxxxxxxxx", "client_root": "xxxxxxxxxxxxx", "entity_ident": "xxxxxxxxxxxxx", "target": null, "comment": null, "status": "transmited", "created_user": "test@test.com", "created_at": 1742200955, "update_at": 1742200955, "scheduled_time": null, "response_time": 1742200955, "ttl": null, "payload": null, "response": "command transmited to mqtt", "notification_mail_list": [] }
4. Track the progress of a job
-
Endpoint:
GET https://api.alemca.io/v3/commands/jobs/{job_ident}/history
(where{job_ident}
is the job identifier, e.g.,0aa8fb62-def8-43ea-ba6b-bee0012c25bd
)Warning
This identifier
6cdc1f68-5f44-4ec7-91ad-952d58df6023
belongs to the Regulation Central task and should not be modified. -
Exemple de réponse :
{ "page": 1, "per_page": 500, "total_pages": 1, "total_items": 2, "items": [ { "task": { "version": 0, "ident": "6cdc1f68-5f44-4ec7-91ad-952d58df6023", "name": "regulation_centrale" }, "group": null, "ident": "xxxxxxxxxxxxx", "client_root": "xxxxxxxxxxxxx", "entity_ident": "xxxxxxxxxxxxx", "target": null, "comment": null, "status": "transmited", "created_user": "test@test.com", "created_at": 1742200955, "update_at": 1742200955, "scheduled_time": null, "response_time": 1742200955, "ttl": null, "payload": null, "response": "command transmited to mqtt", "notification_mail_list": [] }, { "task": { "version": 0, "ident": "6cdc1f68-5f44-4ec7-91ad-952d58df6023", "name": "regulation_centrale" }, "group": null, "ident": "xxxxxxxxxxxxx", "client_root": "xxxxxxxxxxxxx", "entity_ident": "xxxxxxxxxxxxx", "target": null, "comment": null, "status": "initial", "created_user": "test@test.com", "created_at": 1742200955, "update_at": 1742200955, "scheduled_time": null, "response_time": null, "ttl": null, "payload": null, "response": null, "notification_mail_list": [] } ] }