Application Provider API

The application provider REST APIs allow system administrators to send downlinks and register/activate/deactivate devices on an application.


The Application Provider API gives programmatic access to send downlinks and register/activate/deactivate devices on an application. Senet provides application administrators with an API key to authenticate API usage. The REST API responses are in JSON format.

Send downlink messages to devices on the managed application.

Resource URL

https://api.senetco.io/rest/integration/device/sendmsg

HTTP Method

POST

Parameters

Parameter Description Required Default Value Allowed Values
eui The IEEE EUI-64 identifier for the LoRa device. Yes Hexadecimal String
pdu The PDU to send to the device. Yes Hexadecimal String
port The port (fport) to send to the device. No 1 1-254
confirmed The flag to tell the receiving device to acknowledge the reception of the PDU. No false true or false
timeoutMinutes The amount of time in minutes to allow the transaction to be sent prior to timing out the request. No 5 Positive Integer

Curl Example

curl -H "authorization: <API_KEY>" --insecure -X POST "https://api.senetco.io/rest/integration/device/sendmsg?eui=00250C010000030B&pdu=0102030405060708090a0b0c0d0e0f&confirmed=true&timeoutMinutes=2"

Response Example

{  
   "message":"Success!",
   "msgId":119
}

A Device transmits an uplink messages to one or more gateways that relay the message to the network server. The network server forwards the message to an IoT platform.

Application Payload

The Senet Network receives payload data from devices via one or more gateways that receive the transmission. In addition to streaming the payload data (pdu), network information is also included. The data is formatted using JSON and contains the following default fields. Optional RF fields can also be added by enabling "Include RF Data" in the notification target.

The Senet Network supports the standard JSON object model where each object contains one-to-many key/values pairs. The JSON object is in the following format:

Note

Senet may add additional fields during future Portal updates. Please ensure that the application ignores any unknown fields and continue to parse the notification data.

{
   "Key":"String Value",
   "Key": Numeric Value
}

Fields

FieldName DataType Description
ack Boolean Flag indicating if the uplink was acknowledging the receipt of a downlink
devClass String LoRaWAN Class designation ("A", "B", "C") of the device
devEui String 64-bit Extended Unique Identifier of the device transmitting the message
gwEui String 64-bit Extended Unique Identifier of the receiving Gateway that processed the message
joinId Number Incrementing Integer used to Identify the last join
pdu String Protocol Data Unit or Customer Payload data
port Number 0 indicates that the FRMPayload contains MAC commands only and 1..223 are application specific
seqNo Number Incrementing Integer used to Identify an uplink
txtime String Time the message was received by the gateway

Example:

{
   "ack":true,
   "devClass": "A" ,
   "devEui":"FFFFFFFFFFFFFFFF",
   "gwEui":"AAAAAAAAAAAAAAAA",
   "joinId":216,
   "pdu":"01000016D7011400060E06",
   "port":1,
   "seqno":1,
   "txtime":"2017-02-09T12:38:38.375Z"

}


RF Fields

The following fields can be added to the payload by enabling "Include RF Data" in the the notification target editor. This is only available to a user with with administrative privileges.

FieldName DataType Description
channel Number Frequency Channel of the transmission
datarate Number Integer that maps to a spreading factor, bandwidth and bitrate
freq Number Transmit Frequency in MHz
rssi Number Received Signal Strength Indicator reported by receiving gateway
snr Number Average Signal to Noise Ratio reported by receiving gateway

Example with RF Fields:

{
   "ack":true,
   "channel":64,
   "datarate":4,
   "devEui":"FFFFFFFFFFFFFFFF",
   "freq":903,
   "gwEui":"AAAAAAAAAAAAAAAA",
   "joinId":209,
   "pdu":"01000016D7011400060E06",
   "port":1,
   "rssi":-77,
   "seqno":1,
   "snr":10,
   "txtime":"2017-02-09T11:35:44.384Z"
}


Optional Fields

The following data fields are available on Production with contractual agreement:

FieldName DataType Description
estLat Number Estimated latitude of the device in decimal degrees
estLng Number Estimated longitude of the device in decimal degrees

Duplicate uplinks are also available on Production with a contract.

Senet Packet Format

In addition to the above JSON payload types, Senet also offers an extended payload if the device implements the standard Senet Packet Format. See the Senet Packet format documentation for more details.

Device Registration API

Register new devices on the managed application. See Device Registration to learn how to request a token. Only one task can be running at a time per application. The response of a successful request is a URL to GET the status of the registration task. See Task Status API for more information.

Resource URL

https://api.senetco.io/rest/integration/device/register

HTTP Method

POST

Parameters

Parameter Description Required Default Value Allowed Values
token Randomly generated token used for two-factor authentication. Yes Six digit number
appEui The IEEE EUI-64 identifier for application. No EUI of managed application Hexadecimal String
joinEui The IEEE EUI-64 identifier for the join server. No Default join server for managed application Hexadecimal String

Message Data Object

{  
   "data":[  
      {  
         "devEui":"123000000000ABC0",
         "appKey":"1230000000000000000000000000ABC0"
      },
      {  
         "devEui":"123000000000ABC1",
         "appKey":"1230000000000000000000000000ABC1"
      }
   ]
}

Curl Example

curl -H "authorization: <API_KEY>" -H "Content-Type: application/json" -d '{"data":[{"devEui":"123000000000ABC0","appKey":"1230000000000000000000000000ABC0"},{"devEui":"123000000000ABC1","appKey":"1230000000000000000000000000ABC1"}]}' --insecure -X POST "https://api.senetco.io/rest/integration/device/register?token=123456"

Response Example

{  
   "statusUrl":"https://api.senetco.io/rest/integration/device/status?reqId=DevMgmtJobReq:00000000000100E0"
}

Device Activation API

Activate registered or deactivated devices on the managed application. Only one task can be running at a time per application. The response of a successful request is a URL to GET the status of the activation task. See Task Status API for more information.

Resource URL

https://api.senetco.io/rest/integration/device/activate

HTTP Method

POST

Parameters

Parameter Description Required Default Value Allowed Values
appEui The IEEE EUI-64 identifier for application. No EUI of managed application Hexadecimal String
joinEui The IEEE EUI-64 identifier for the join server. No Default join server for managed application Hexadecimal String

Message Data Object

{  
   "data":[  
      {  
         "devEui":"123000000000ABC0"
      },
      {  
         "devEui":"123000000000ABC1"
      }
   ]
}

Curl Example

curl -H "authorization: <API_KEY>" -H "Content-Type: application/json" -d '{"data":[{"devEui":"123000000000ABC0"},{"devEui":"123000000000ABC1"}]}' --insecure -X POST "https://api.senetco.io/rest/integration/device/activate"

Response Example

{  
   "statusUrl":"https://api.senetco.io/rest/integration/device/status?reqId=DevMgmtJobReq:00000000000100E0"
}

Device Deactivation API

Deactivate activated or registered devices on the managed application. Only one task can be running at a time per application. The response of a successful request is a URL to GET the status of the deactivation task. See Task Status API for more information.

Resource URL

https://api.senetco.io/rest/integration/device/deactivate

HTTP Method

POST

Parameters

Parameter Description Required Default Value Allowed Values
appEui The IEEE EUI-64 identifier for application. No EUI of managed application Hexadecimal String
joinEui The IEEE EUI-64 identifier for the join server. No Default join server for managed application Hexadecimal String

Message Data Object

{  
   "data":[  
      {  
         "devEui":"123000000000ABC0"
      },
      {  
         "devEui":"123000000000ABC1"
      }
   ]
}

Curl Example

curl -H "authorization: <API_KEY>" -H "Content-Type: application/json" -d '{"data":[{"devEui":"123000000000ABC0"},{"devEui":"123000000000ABC1"}]}' --insecure -X POST "https://api.senetco.io/rest/integration/device/deactivate"

Response Example

{  
   "statusUrl":"https://api.senetco.io/rest/integration/device/status?reqId=DevMgmtJobReq:00000000000100E0"
}

Device Update API

Update the fields of devices that have joined on the managed application. The latitude and longitude fields can be edited and new tags can be added. Only one task can be running at a time per application. The response of a successful request is a URL to GET the status of the update task. See Task Status API for more information.

Resource URL

https://api.senetco.io/rest/integration/device/update

HTTP Method

POST

Parameters

Parameter Description Required Default Value Allowed Values
appEui The IEEE EUI-64 identifier for application. Yes Hexadecimal String

Message Data Object

{  
   "data":[  
      {  
         "devEui":"123000000000ABC0",
         "lat":43.0775992,
         "lng":-70.7596765,
         "tags":"tag1;tag2"
      },
      {  
         "devEui":"123000000000ABC1",
         "lat":40.7484445,
         "lng":-73.9878584,
         "tags":"tag1"
      }
   ]
}

Curl Example

curl -H "authorization: <API_KEY>" -H "Content-Type: application/json" -d '{"data":[{"devEui":"123000000000ABC0","lat":43.0775992,"lng":-70.7596765,"tags":"tag1;tag2"},{"devEui":"123000000000ABC1","lat":40.7484445,"lng":-73.9878584,"tags":"tag1"}]}' --insecure -X POST "https://api.senetco.io/rest/integration/device/update?appEui=00000000000100E0"

Response Example

{  
   "statusUrl":"https://api.senetco.io/rest/integration/device/status?reqId=DevUpdateJobReq:00000000000100E0"
}

Task Status API

Get the status of an ongoing device registration, activation or deactivation task. The status is available for 15 minutes after the task is complete.

Resource URL

https://api.senetco.io/rest/integration/device/status

HTTP Method

GET

Parameters

Parameter Description Required Default Value Allowed Values
reqId Identifier of the ongoing task. Yes Id String

Curl Example

curl -H "authorization: <API_KEY>" --insecure "https://api.senetco.io/rest/integration/device/status?reqId=DevMgmtJobReq:00000000000100E0"

Response Example

{  
   "state":"DONE_SUC",
   "result":{  
      "status":"Device activation on App EUI: 00000000000100E0 completed. Activated: 0 Updated: 0 Not Changed: 0 Errors: 1",
      "msgs":[  
         "DevEUI: 1230000000000ABC has not been registered. The device cannot be activated on JoinEUI: 00000000000100E0."
      ]
   },
   "pctDone":100
}

Status Codes

200 The task specified was successfully found. The latest status is returned.

400 The reqId parameter is missing or invalid.

403 The API key is not authorized to get the status of the task.

404 No task could be found with the requested reqId.

Response Details

pctDone

Current status of the task expressed as a percentage (0 to 100).

state

Current state of the task.

DONE_SUC The task finished successfully.
DONE_FAIL An internal server exception occurred while running the task.
INITIAL The task has been created and is waiting to be queued.
QUEUED The task has been queued and is waiting to be run.
RUNNING The task is running.

status

Summary of the task after completion.

Registered Number of devices successfully registered.
Activated Number of devices successfully activated.
Deactivated Number of devices successfully deactivated.
Updated Number of device appKeys updated.
Not Changed Number of devices in the request that did not change.
Errors Number of errors that occurred.

msgs

Messages describing any errors that occurred while running the task.

Registration Messages
An internal server error occurred while registering devices. <NUM_SKIPPED> devices were skipped.
Activation Messages
The AppKey for DevEUI: <DEV_EUI> has been updated. Old AppKey: <APP_KEY> New AppKey: <APP_KEY>.
DevEUI: <DEV_EUI> has not been registered. The device cannot be activated on JoinEUI: <JOIN_EUI>.
An internal server error occurred while activating DevEUI: <DEV_EUI>.
DevEUI: <DEV_EUI> has already joined on AppEUI: <APP_EUI>. The device cannot be activated on AppEUI: <APP_EUI>.
DevEUI: <DEV_EUI> was already activated on AppEUI: <APP_EUI>. The device cannot be activated on AppEUI: <APP_EUI>.
An internal server error occurred while activating devices.
Deactivation Messages
DevEUI: <DEV_EUI> has not been registered. The device cannot be deactivated.
An internal server error occurred while deactivating devices.