Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:api_def [2017/01/24 14:03]
admin [Alarms]
en:api_def [2017/03/07 16:09] (current)
admin [Alarms]
Line 13: Line 13:
 The method to request or send data to NeMo is to send a JSON message containing the command and related parameters. The output will be a JSON message containing the response to the request. The method to request or send data to NeMo is to send a JSON message containing the command and related parameters. The output will be a JSON message containing the response to the request.
 Users can send messages through two different channels: Users can send messages through two different channels:
-via HTTP using the script //​**api.php**//​  +  * via HTTP using the script //​**api.php**//​  
-via the NeMo message broker that use the AMQP protocol, through the queue "​**nemoapi**" ​+  ​* ​via the NeMo message broker that use the AMQP protocol, through the queue "​**nemoapi**" ​
  
 To test the API messages there is the page apitest.php To test the API messages there is the page apitest.php
Line 91: Line 91:
   * [[#​alarmActive|alarmActive]]   * [[#​alarmActive|alarmActive]]
   * [[#​alarmGet|alarmGet]]   * [[#​alarmGet|alarmGet]]
 +  * [[#​alarmMultiget|alarmMultiget]]
 +
  
 === alarmActive === === alarmActive ===
Line 117: Line 119:
        "​param":​ {  }        "​param":​ {  }
     },     },
-    "​response": ​[ +    "​response": ​{ 
-    {....}, +       "​responseType":​ "​full", ​   //valid options: "​full",​ "​partial"​ 
-    {....} +       "​data":​ [ 
-    ]+          ​{....}, 
 +          {....} 
 +       ​] 
 +   } 
 +}
 </​code>​ </​code>​
  
-The "​response" ​field contains ​an array of event description. The format is the same as that contained in the [[#​alarmGet|alarmGet]] command.+The "​response" ​object ​contains ​the "​responseType"​ field that specify if the content is complete (full) or partial. In case of "​partial"​ response, only the first API_ALARM_MULTIGET_MAXEVENT alarms will be fully provided (if API_ALARM_MULTIGET_MAXEVENT is equal to 0 all messages will be provided in a single response); for the remaining alarms will be provided only the **eventId** field and the client have to call other **alarmGet** or **alarmMultiget** requests to obtain complete information 
 +The format ​for each event elements, ​is the same as that contained in the [[#​alarmGet|alarmGet]] command.
  
 === alarmGet === === alarmGet ===
Line 182: Line 189:
 } }
 </​code>​ </​code>​
 +
 +
 +=== alarmMultiget ===
 +
 +Request information about multiple alarms.
 +
 +Request:
 +
 +<​code>​
 +{
 +   "​cmd":​ "​alarmMultiget",​
 +   "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +   "​param":​ {
 +      "​eventIds":​ [123,​234,​345,​456,​567,​678,​.....]
 +   }
 +}
 +</​code>​
 +
 +Response:
 +
 +<​code>​
 +{
 +   "​success":​ true,
 +   "​request": ​
 +    {
 +      "​cmd":​ "​alarmMultiget",​
 +      "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +      "​param":​ {
 +         "​eventIds":​ [123,​234,​345,​456,​567,​678,​.....]
 +      }
 +    },
 +    "​response":​ {
 +       "​responseType":​ "​full", ​   //valid options: "​full",​ "​partial"​
 +       "​data":​ [
 +          {....},
 +          {....}
 +       ]
 +   }
 +}
 +</​code>​
 +
 +The "​response"​ object contains the "​responseType"​ field that specify if the content is complete (full) or partial. In case of "​partial"​ response, only the first API_ALARM_MULTIGET_MAXEVENT alarms will be fully provided (if API_ALARM_MULTIGET_MAXEVENT is equal to 0 all messages will be provided in a single response); for the remaining alarms will be provided only the **eventId** field and the client have to call other **alarmGet** or **alarmMultiget** requests to obtain complete information. ​
 +The format for each event elements, is the same as that contained in the [[#​alarmGet|alarmGet]] command.
 +
 +
 +
 +==== Queue ====
 +
 +These are the command to use in order to manipulate queues.
 +
 +  * [[#​queueLength|queueLength]]
 +  * [[#​queuePurge|queuePurge]]
 +
 +
 +=== queueLength ===
 +
 +Request the number of message in a specific queue.
 +
 +Request:
 +
 +<​code>​
 +{
 +   "​cmd":​ "​queueLength",​
 +   "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +   "​param":​ {
 +      "​queueName":​ "​fooQueue"​
 +   }
 +}
 +</​code>​
 +
 +Response:
 +
 +<​code>​
 +{
 +   "​success":​ true,
 +   "​request": ​
 +    {
 +      "​cmd":​ "​queueLength",​
 +      "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +      "​param":​ {
 +         "​queueName":​ "​fooQueue"​
 +      }
 +    },
 +    "​response":​ {
 +       "​length":​ 25
 +    }
 +}
 +</​code>​
 +
 +
 +=== queuePurge ===
 +
 +Purge the specified queue.
 +
 +Request:
 +
 +<​code>​
 +{
 +   "​cmd":​ "​queuePurge",​
 +   "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +   "​param":​ {
 +      "​queueName":​ "​fooQueue"​
 +   }
 +}
 +</​code>​
 +
 +Response:
 +
 +<​code>​
 +{
 +   "​success":​ true,
 +   "​request": ​
 +    {
 +      "​cmd":​ "​queuePurge",​
 +      "​token":​ "​eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."​
 +      "​param":​ {
 +         "​queueName":​ "​fooQueue"​
 +      }
 +    },
 +    "​response":​ {}
 +}
 +</​code>​
 +