11. Servidor de comando APIURL de control y control
https://<dirección>:8080/comando_dispositivo
Parámetros de entrada
$agent_id- ID del dispositivo en el sistema PILOT
$command_id: identificador de comando único en el sistema PILOT
$json_params — parámetros de comando en formato JSON, por ejemplo {"duration":5, "feature":"my_feature"}
Servicios
Obtener una lista de comandos
RECIBIR
https://<dirección>:8080/device_command/special_commands?agent_id=$agent_id
enviar comando
CORREO
https://<dirección>:8080/comando_dispositivo
Parámetros de publicación:
special_command_id= $command_id &agent_id=$agent_id¶meters=$json_params
Eliminar comando
BORRAR
https://<dirección>:8080/device_command/$command_id
Obtener historial de comandos
RECIBIR
https://<dirección>:8080/device_command/history?command_type=special&agent_id=$agent_id
Ejemplos
enviar comando
https://<dirección>:8080/comando_dispositivo
PUBLICACIÓN: special_command_id=605&agent_id=69085¶meters={"duration":5}
Respuesta:
HTTP/1.1 200 correcto
o
HTTP/1.1 400 Solicitud incorrecta
{"message": "Comando o ID de agente no válido"}
Lista de comandos
https://<dirección>:8080/device_command/special_commands?agent_id=69085
Respuesta:
[
{
"agent_id": 69085,
"command_name": "ring",
"command_parameters": [
{
"param_default_value": 5,
"param_field_name": "duration",
"param_max_value": 999,
"param_min_value": 0,
"param_name": "duration",
"param_type": "integer"
}
],
"description": "ring",
"id": "605"
},
{
"agent_id": 69085,
"command_name": "unlock",
"command_parameters": [
{
"param_default_value": 0,
"param_field_name": "user_id",
"param_max_value": 999999999,
"param_min_value": 0,
"param_name": "user_id",
"param_type": "integer"
}
],
"description": "unlock",
"id": "601"
},
{
"agent_id": 69085,
"command_name": "get_sim_iccid",
"command_parameters": [
],
"description": "get_sim_iccid",
"id": "599"
},
{
"agent_id": 69085,
"command_name": "lock_status",
"command_parameters": [
],
"description": "lock_status",
"id": "598"
},
{
"agent_id": 69085,
"command_name": "query_firmware_ver",
"command_parameters": [
],
"description": "query_firmware_ver",
"id": "597"
},
{
"agent_id": 69085,
"command_name": "alarm",
"command_parameters": [
],
"description": "alarm",
"id": "596"
},
{
"agent_id": 69085,
"command_name": "position",
"command_parameters": [
],
"description": "position",
"id": "595"
}
]
Historia
https://<dirección>:8080/device_command/history?command_type=special&agent_id=69085
Respuesta:
{
"items": [
{
"id": 58075,
"creation_timestamp": 1569330907,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569330907,
"command": "query_firmware_ver",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "queued",
"answer": null,
"command_name": "query_firmware_ver"
},
{
"id": 58255,
"creation_timestamp": 1569419121,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569419121,
"command": "position",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "accepted",
"answer": null,
"command_name": "position"
},
{
"id": 58256,
"creation_timestamp": 1569419144,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569419144,
"command": "get_sim_iccid",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "get_sim_iccid"
},
{
"id": 58257,
"creation_timestamp": 1569419661,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569419661,
"command": "position",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "accepted",
"answer": null,
"command_name": "position"
},
{
"id": 58258,
"creation_timestamp": 1569437512,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569437512,
"command": "query_firmware_ver",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "query_firmware_ver"
},
{
"id": 58259,
"creation_timestamp": 1569437904,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569437904,
"command": "get_sim_iccid",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "get_sim_iccid"
},
{
"id": 58260,
"creation_timestamp": 1569438396,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569438396,
"command": "ring",
"parameters": {
"duration": "5"
},
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "ring"
},
{
"id": 58272,
"creation_timestamp": 1569482788,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569482788,
"command": "position",
"parameters": [],
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "accepted",
"answer": null,
"command_name": "position"
},
{
"id": 58273,
"creation_timestamp": 1569482843,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569482843,
"command": "ring",
"parameters": {
"duration": "5"
},
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "ring"
},
{
"id": 58275,
"creation_timestamp": 1569487616,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569487616,
"command": "ring",
"parameters": {
"duration": "5"
},
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "ring"
},
{
"id": 58276,
"creation_timestamp": 1569489219,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569489219,
"command": "unlock",
"parameters": {
"user_id": 0
},
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "unlock"
},
{
"id": 58277,
"creation_timestamp": 1569489261,
"raw_command": {
"device_id": "863921030920816",
"creation_timestamp": 1569489261,
"command": "unlock",
"parameters": {
"user_id": 0
},
"server": {
"address": "pilot-gps.com",
"port": "8080"
}
},
"status": "new",
"answer": null,
"command_name": "unlock"
}
],
"total": 12
}
|