RESTful interface

Top  Previous  Next

For those who wish to send data to DAQConnect from their own code and not use the Windows DLL we offer a simple RESTful interface that allows posting data to DAQConnect using simple HTTP GET (or POST) requests.  This makes it easy to send data from just about any source, no matter what the operating system or programming language.

The URL for the RESTful is:

https://www.daqconnect.com/daq/postData.do

 

You can use POST or GET.  GET has a length limit (typically 1024 characters), POST does not.  Although not as secure, you can use http:// as well.

There are two ways of sending data:

Data for a single tag

The URL parameters for a single data point are:

1.  c=<Connector UUID>

2.  t=<Tag Name>

3.  d=<time>:<value> (this parameter can be repeated as many times as necessary)

NOTE: Time should always be in UTC (coordinated universal time).  This allows your DAQConnect pages to display data in the local time zone.

An example HTTP GET that sends a single data point would be:

https://www.daqconnect.com/daq/postData.do?c=12345678-1234-1234-1234-123456789012&t=testTag&d=1257449020.855:103.94

 

To send multiple data points for a single tag the HTTP GET would look like:

https://www.daqconnect.com/daq/postData.do?c=12345678-1234-1234-1234-123456789012&t=testTag&d=1257449020.855:103.941&d=1257449021.855:104.95

 

An example of an HTTP POST payload for the previous request would look like:

c=12345678-1234-1234-1234-123456789012

&t=testTag

&d=1257449020.855:103.941&d=1257449021.855:104.95

 

Data for multiple tags

To send data for multiple tags add these URL parameters

1.  c=<Connector UUID>

2.  t=<Tag Name>:<time>:<value> (this can be repeated as many times as necessary)

NOTE: Time should always be in UTC (coordinated universal time).  This allows your DAQConnect pages to display data in the local time zone.

An example HTTP GET that sends two tags:

https://www.daqconnect.com/daq/postData.do?c=12345678-1234-1234-1234-123456789012&t=testTag:1257449020.855:103.94&t=wind:1257449020.855:103.94

 

Return payload

A simple JSON packet is returned that contains the status of the operation: { "status" : result }.  Where result is:

0 : Data has been received and stored

2 : The customer account is expired.  Please log in and update your account.

3 : The connector UUID is invalid.  It may have been deleted from the account or mistyped in the URL.

5 : Sending data faster than the account is permitted to send data.

6 : No more room to store any data in separate tags.  Delete old tags or update your account to add more tag storage.

7 : No more room to store extra data.  Delete old tags or update your account to add more storage.

HTTP Content-Type Header

The HTTP content type header for a POST request must be: application/x-www-form-urlencoded

Adding Control Capability

If you want to allow control capability through DAQConnect, that is, having DAQConnect send messages to your device, you should use a slightly different API.  The data sent is exactly the same, except the URL is different.  It becomes:

https://www.daqconnect.com/daq/postDataControl.do

The response is what is different.  It looks something like this:

{
  "status" : status-code,
  "controls" : {
    "data" : []
  }
}
 

If there are no control values for the connector then the "controls" object will not exist, for example:

{ "status" : status-code }

 

If there are control values then the message will look like this:

{
  "status" : status-code,
  "controls" : {
    "data" : [ [ key1, value1 ], [ key2, value2] ]
  }
}

 

"key" is a string containing whatever key was specified using the Set() command in DAQConnect.  Note that the connector information is stripped from the key, so "remote.mykey" becomes just "mykey".  The connector part is used to determine who gets the response.  "Value" is also a string, but could contain a numeric value, i.e. "3.412", and is simply the value parameter of the Set() command.