Support Commands for Direct Methods
ThingsPro Agent offered below 6 direct methods. You can invoke them when device is on-line.
No | Method Name | Description |
---|---|---|
1 | thingspro-api-v1 | An universal direct method, allow to invoke almost all Restful API of ThingsPro Edge. |
2 | system-reboot | A direct method to restart Moxa's device. |
3 | thingspro-applications-control | To control application run time on device. |
4 | thingspro-software-upgrade | To perform software upgrade over the air. |
ThingsPro Agent Universal Method
An universal direct method, to invoke almost all Restful API on ThingsPro Edge device. You can get ThingsPro Edge Restful API document at here.
Method Name:
thingspro-api-v1
Request Payload: (Example to set SSH configuration)
{
"path":"/system/sshserver",
"method":"PUT",
"headers":[],
"requestBody": {"enable": true, "port": 22}
}No Name Description 1 path ThingsPro Edge Restful API endpoint. 2 method The method which associated with API endpoint. 3 headers It shall always be application/json. 4 requestBody The post data which required by API endpoint. Response:
{
"status":200,
"payload":{"data":{"enable":true,"port":22}}
}Example screen shot
Restart Device
This command will trigger device to reboot immediately.
Method Name:
system-reboot
Request Payload:
{}
Response:
{
"status": 200,
"payload": {
"data": "rebooting"
}
}
Control Application runtime
This direct method offers you a quick way to start/stop/restart applications which running on ThingsPro Edge.
Method Name:
thingspro-applications-control
Request Payload:
{
"appName": "modbusmaster-tcp",
"command": "stop"
}No Name Description 1 appName The name of applications running and managed by ThingsPro Edge. You can get application list by ThingsPro Restful API. 2 command Support commands:
- start
- stop
- restartResponse:
{
"status": 200,
"payload": {
"data": ""
}
}
Software Upgrade
This direct method allow you to download upgrade software over the air.
Method Name:
thingspro-software-upgrade
Example to trigger download and installation at one upgrade job
- Request Payload:
{
"downloadURL": "http://xxx/edge/87/doc_0.1.0-87_armhf.yaml",
"runInstallation": true
}No Name Description 1 downloadURL The URL point to upgrade software location. 2 runInstallation value true : The installation task will auto start after download task completed. - Response:
{
"status": 200,
"payload": {
"data": {
"id": 1
}
}
}
Example to trigger a download software only upgrade job
- Request Payload:
{
"downloadURL": "http://xxx/edge/87/doc_0.1.0-87_armhf.yaml",
"runInstallation": false
}No Name Description 1 downloadURL The URL point to upgrade software location. 2 runInstallation value false : The installation task doesn't start by default. You can invoke next direct method to launch it. - Response:
{
"status": 200,
"payload": {
"data": {
"id": 2
}
}
}
Example to trigger an installation for a upgrade job id
- Request Payload:
{
"id": 2,
"runInstallation": true
}No Name Description 1 runInstallation Value shall always be true at this case. 2 id The Id returned from previous direct method. - Response
{
"status": 200,
"payload": {
"data": {
"id": 3
}
}
}
- ThingsPro agent will send back upgrade progress and status via reported properties.
Report download progress
Download success
- ThingsPro Edge allow only one active software upgrade job once.
Last updated on 2022-05-31 by Aeluin Chen (陳映攸)