Neon REST API V10.7.0.19604

The Neon REST API allows for access to various elements of a Neon system. This reference provides a description of how to use this API.

Table of Contents

API Overview

Authentication

Available Operations

HTTP Status Codes

API Overview

The base address for the Neon REST API is at: https://restservice-neon.surechem.com.my:443/NeonRESTService.svc

All the operation Requests detailed below are to be appended to the above address.

All body parameters associated with POST requests need to be JSON encoded and with the following request header: Content-Type: application/json

All responses are JSON encoded.

All data times are in a node's local time zone, unless specified otherwise.

IMPORTANT: A scheme change in Neon will sometimes result in new data channels being created for a node. If this occurs, the Channel IDs for data arriving
under the new scheme will have changed and data channel mapping that is performed by client software will need to be updated.

Authentication

Authentication is achieved by establishing a session and obtaining an authentication Token. The Token is then used for all subsequent requests to the API by adding the token as a request header, for example:

X-Authentication-Token: KKRbnGH/2NvJgbjG1X0BMghC9XH1a/wXR3UneyFKsmo=

The token will remain valid for 24 hours.

Either one of the requests below can be used to establish a session:

Request HTTP Method Query Parameters Body Parameters Success Response Example
/GetSession?u=Username&p=Password GET Username is the Neon user name

Password is the Neon password

{
 "Token":"KKRbnGH/2NvJgbjG1X0BMghC9XH1a/wXR3UneyFKsmo="
}
/PostSession POST {
 "Username": "username",
 "Password": "password"
}
{
 "Token":"KKRbnGH/2NvJgbjG1X0BMghC9XH1a/wXR3UneyFKsmo="
}

Available Operations
Request HTTP Method Query Parameters Body Parameters Success Response Example
/GetNodeList GET {
 "GetNodeListResult":
 [
  {
   "ID": 1,
   "Name": "node1",
   "Code": "",
   "ParentID": 0,
   "Hierarchy": 1
  },
  {
   "ID": 2,
   "Name": "node2",
   "Code": "",
   "ParentID": 1,
   "Hierarchy": 2
  }
 ]
}
/GetChannelList/NodeID?ShowInactive=Inactive GET NodeID is the ID of the node, as returned by the /GetNodeList request

Inactive is an optional parameter to show inactive channels, set to true or false. Default is false.
{
 "GetChannelListResult":
 [
  {
    "ID": 1,
    "Name": "Internal Battery(RAW)",
    "Status": Active,
    "Units": "mV",
    "FirstTime": 2013-04-29T11:20:00,
    "FirstValue": 3500,
    "LastTime": 2013-08-15T09:12:20,
    "LastValue": 3400
   },
   {
    "ID": 2,
    "Name": "External Battery(RAW)",
    "Status": Active,
    "Units": "V",
    "FirstTime": 2013-04-29T11:20:00,
    "FirstValue": 12.1,
    "LastTime": 2013-08-15T09:12:20,
    "LastValue": 11.9
   }
 ]
}
/GetActiveChannelList/NodeID GET NodeID is the ID of the node, as returned by the /GetNodeList request
{
 "GetActiveChannelListResult":
 [
  {
    "ID": 1,
    "Name": "Internal Battery(RAW)",
    "Status": Active,
    "Units": "mV"
   },
   {
    "ID": 2,
    "Name": "External Battery(RAW)",
    "Status": Active,
    "Units": "V"
   }
 ]
}
/GetData/ChannelID?StartTime=StartTime&EndTime=EndTime
    &DSTAdjust=DSTAdjust
GET ChannelID is the ID of the channel, as returned by the /GetChannelList request.

StartTime is the date and time of the first data sample.

EndTime is the date and time of the last data sample.

DSTAdjust is an optional parameter to apply daylight savings to the data times, set to true or false. Default is false.
{
 "GetDataResult":
  {
   "ID": 1,
   "Name": "Internal Battery(RAW)",
   "Active": "True",
   "Units": "mV",
   "Samples":
   [
    {
     "Time": "2013-04-29T11:20:00",
     "Value": "3500"
    },
    {
     "Time": "2013-04-29T11:30:00",
     "Value": "3501"
    }
   ]
  }
}
/GetDataResampled/ChannelID?StartTime=StartTime&EndTime=EndTime
    &DSTAdjust=DSTAdjust&Interval=Interval&Method=Method
GET ChannelID is the ID of the channel, as returned by the /GetChannelList request.

StartTime is the date and time of the first data sample.

EndTime is the date and time of the last data sample.

DSTAdjust is an optional parameter to apply daylight savings to the data times, set to true or false. Default is false.

Interval is the re-sampling interval, in hours.

EndTime is the re-sampling method. Allowed values are min, max, mean and sum.

{
 "GetDataResampledResult":
  {
   "ID": 1,
   "Name": "Internal Battery(RAW)",
   "Active": "True",
   "Units": "mV",
   "Interval": 7,
   "Method": mean,
   "Samples":
   [
    {
     "Time": "2013-04-29T11:00:00",
     "Value": "3500"
    },
    {
     "Time": "2013-04-29T18:00:00",
     "Value": "3501"
    }
   ]
  }
}

NOTES:
The Time parameter for each data sample represents the start time of the re-sampling interval.
/GetDataMultiChannel?Channels=ChannelIDList
    &StartTime=StartTime&EndTime=EndTime
    &DSTAdjust=DSTAdjust
GET ChannelIDList is a comma separated list of ID for the channels, as returned by the /GetChannelList request.

StartTime is the date and time of the first data sample.

EndTime is the date and time of the last data sample.

DSTAdjust is an optional parameter to apply daylight savings to the data times, set to true or false. Default is false.
{
 "GetDataMultiChannelResult":
 [
  {
   "ID": 1,
   "Name": "Internal Battery(RAW)",
   "Active": "True",
   "Units": "mV",
   "Samples":
   [
    {
     "Time": "2013-04-29T11:20:00",
     "Value": "3500"
    },
    {
     "Time": "2013-04-29T11:30:00",
     "Value": "3501"
    }
   ]
  },
  {
   "ID": 2,
   "Name": "External Battery(RAW)",
   "Active": "True",
   "Units": "V",
   "Samples":
   [
    {
     "Time": "2013-04-29T11:20:00",
     "Value": "12.1"
    },
    {
     "Time": "2013-04-29T11:30:00",
     "Value": "11.9"
    }
   ]
  }
 ]
}
/GetRTDPackets/NrtID?Device=Device
    &NumberPackets=NumberPackets
GET NrtID is the ID of the NRT

Device is set to 0 for the communicator RTD, 1 for the internal logger RTD.

NumberPackets is the maximum number of RTD packets to retrieve, starting from the latest packet going backwards.
{
 "GetRTDPacketsResult":
 [
  {
   "TimeUtc": "2013-10-22T01:18:36",
   "Data": [ 135, 157, 1, 7, 193, ... 2, 0, 0, 0 ],
   "Scheme": "0"
  },
  {
   "TimeUtc": "2013-10-22T01:15:16",
   "Data": [ 43, 153, 1, 7, 193, ... 0, 0, 0, 0 ],
   "Scheme": "0"
  }
 ]
}
/SendNrtCommand/NrtId POST NrtID is the ID of the NRT

{
 "Command":[19,191,1,0]
}
{
 "SendNrtCommandResult":{
  "CommandGuid":"0db20264-f0e7-4084-94d9-3dd567825463"
 }
}
/GetNrtCommandStatus/NrtCommandGuid GET NrtCommandGuid is the identifier previously returned by a SendNrtCommand request. {
 "GetNrtCommandStatusResult":{
  "CommandStatus":"Queued"
 }
}
/ImportData/NrtId?LoggerType=LoggerType POST NrtID is the ID of the NRT

LoggerType specifies whether the imported data will be sent to the internal (1) or external (2) logger.
{
 "Data":
 [
  {
   "SensorNumber": "0",
   "ImportType": "0",
   "Samples": [
    {
     "Time": "2013-04-29T11:20:00",
     "Value": "3500"
    },
    {
     "Time": "2013-04-29T11:30:00",
     "Value": "3501"
    }
   ]
  },
  {
   "SensorNumber": "1",
   "ImportType": "0",
   "Samples": [
    {
     "Time": "2013-04-29T11:20:00",
     "Value": "12.1"
    },
    {
     "Time": "2013-04-29T11:30:00",
     "Value": "11.9"
    }
   ]
  }
 ]
}

NOTES:
Sample Times must be in UTC.

The ImportType parameter controls how the imported data is to be processed:
"0" - Add the new data samples to the channel
"1" - Edit data sample values at the given times
"2" - Delete data samples at the given times. The Value data member is ignored and can be set to any number or omitted.
"3" - Undo the Edit or Delete of data samples at the given times. The Value data member is ignored and can be set to any number or omitted.
/SaveNode POST {
 "Node":
  {
   "ID": "123",
   "Name": "Name",
   "NodeCode": "Code",
   "ParentID": "122",
   "TimeZone": "W. Australia Standard Time",
   "Latitude": -34.0629918145742,
   "Longitude": 115.799428224564,
   "AdministratorEmail": "neonsupport@unidata.com.au",
   "ExternalContent": false,
   "Notes": "Notes",
   "StripCharts": true
  }
}

NOTES:
1. The "ID" parameter is omitted when adding a new node
{
 "SaveNodeResult":
  {
   "NodeID": "123",
  }
}
/GetNodeDetails/NodeID GET NodeID is the ID of the Node

{
 "GetNodeDetailsResult":
  {
   "ID": "123",
   "Name": "Name",
   "NodeCode": "Code",
   "ParentID": "122",
   "TimeZone": "W. Australia Standard Time",
   "Latitude": -34.0629918145742,
   "Longitude": 115.799428224564,
   "AdministratorEmail": "neonsupport@unidata.com.au",
   "ExternalContent": false,
   "Notes": "Notes",
   "StripCharts": true
  }
}

NOTES:
1. The "ID" parameter is omitted when adding a new node
/DeleteNode/NodeID GET NodeID is the ID of the Node

/SaveLogger POST {
 "Logger":
  {
   "NodeID": "123",
   "SerialNumber": "12345678",
   "LoggerName": "Name",
   "LoggerModel": "Code",
   "Active": true,
   "Decommission": flase,
   "Virtual": false,
   "MQTT": true,
   "CommsIMEI": "1234567",
   "UseEventDataTimestamp": true,
   "AutoColdBoot": true,
   "ExternalPowerCutoff": "5100",
   "CommsFrequency": 5,
   "CommsLateDelaySeconds": 150,
   "CommsOffset": "00:00",
   "NeonFile": [ 80, 75, 3, 4, 20, 0, ..., 224, 50, 0, 0, 0, 0 ]"
  }
}

NOTES:
1. The "NrtID" parameter is omitted when adding a new logger
2. The CommsIMEI and UseEventDataTimestamp parameters are only used for MQTT loggers
3. The NeonFile is a comma delimited array of bytes, encoded as decimals
{
 "SaveLoggerResult":
  {
   "NrtID": "501",
  }
}
/GetLoggerDetails/NrtID GET NrtID is the NRT ID of the Logger

{
 "GetLoggerDetailsResult":
  {
   "NodeID": "123",
   "NrtID": "205",
   "SerialNumber": "123456",
   "LoggerName": "Name",
   "LoggerModel": "Code",
   "Active": true,
   "Decommission": false,
   "Virtual": false,
   "MQTT": false,
   "CommsIMEI": "12345",
   "AutoColdBoot": true,
   "UseEventDataTimestamp": true,
   "ExternalPowerCutoff": "5100",
   "CommsFrequency": 5,
   "CommsLateDelaySeconds": 150,
   "CommsOffset": "00:00",
   "CommsRetryWaitPeriod": 10,
   "CommsRetryAttempts": 0,
   "CommsIPAttempts": 3,
   "CommsIPTimeout": 5,
   "XMLFileActive": [ 60, 63, 120, 109, 108, ..., 69, 62, 13, 10 ]",
   "SXSFileActive": [ 80, 75, 3, 4, 20, 0, ..., 69, 62, 13, 10 ]",
   "XMLFilePending": [ 60, 63, 120, 109, 108, ..., 69, 62, 13, 10 ]",
   "SXSFilePending": [ 80, 75, 3, 4, 20, 0, ..., 69, 62, 13, 10 ]",
  }
}

NOTES:
1. The XML and SXS files are comma delimited arrays of bytes, encoded as decimals
/DeleteLogger/NrtID GET NrtID is the NRT ID of the Logger

/UploadNodePhoto/NodeID POST NodeID is the ID of the Node

{
 "Photo":
  {
   "ImageType":"JPEG" or "H264"
   "ImageName":"Photo Name"
   "Image":[19,191,1,0...0,45,0]
  }
}

NOTES:
1. The Image is a comma delimited array of bytes, encoded as decimals
{
 "UploadNodePhotoResult":
  {
   "PhotoID":"123"
   "PhotoTimeUTC":"2019-01-08T11:00:00"
   "ImageType":"JPEG" or "H264"
   "ImageName":"Photo Name"
  }
}
/GetNodePhoto/PhotoID GET PhotoID is the ID of the Photo

{
 "GetNodePhotoResult":
  {
   "PhotoID":"123"
   "PhotoTimeUTC":"2019-01-08T11:00:00"
   "ImageType":"JPEG" or "H264"
   "ImageName":"Photo Name"
   "Image":[19,191,1,0...0,45,0]
  }
}

NOTES:
1. The Image is a comma delimited array of bytes, encoded as decimals
/GetNodePhotoList/NodeID GET NodeID is the ID of the Node

{
 "GetNodePhotoListResult":
  [
   {
    "PhotoID":"123"
    "PhotoTimeUTC":"2019-01-08T11:00:00"
    "ImageType":"JPEG" or "H264"
    "ImageName":"Photo Name"
   },
   {
    "PhotoID":"124"
    "PhotoTimeUTC":"2019-01-08T12:00:00"
    "ImageType":"JPEG" or "H264"
    "ImageName":"Photo Name"
   }
  ]
}
/DeleteNodePhoto/PhotoID GET PhotoID is the ID of the Photo

HTTP Status Codes

The HTTP Status Codes are used to indicate the success or otherwise of an operation. The table below summarises some of the possible HTTP status codes returned by the API.

HTTP Status Code Description Notes
200 Success The requested operation has completed successfully.
400 Bad Request This typically indicates that the Request URL or its parameters are malformed. A more detailed description of the error may be available in the Response body.
401 Unauthorised An operation has been requested without adequate authorisation. Below are some possible reasons for this to occur:
- A session has not yet been established
- There is no Request header with the authentication token
- The token has expired
- The token has become corrupted
404 Not Found This typically indicates that the Request URL is incorrect or malformed.
405 Method Not Allowed The typically indicates that the incorrect HTTP Method (eg GET, POST) has been used for a particular operation.
500 Internal Server Error This typically indicates that an unexpected error has occurred in the processing of an operation. A more detailed description of the error may be available in the Response body.