This api call creates a new session in the database.
If a UUID is supplied, any existing session with that UUID is deleted first. Otherwise, if no UUID is supplied One is created.
This api call accepts the following content-types:
For the form request types, attachments can be uploaded to the database at the same time as uploaded the session. The attachments must be in the correct field names to be recognised, as detailed below.
The request is expected to contain a structured document as follows:
JSON example:
{
"session":{
"uuid" : "12341234-12341234-1234-1234-123412341234",
"unit_id" : "mydevice",
"created" : 1234567890,
"saved" : 1234567890,
"data" : {
"point1" : "value1",
"point2" : "value2",
"sketch1" : { "rawData" : "base-64-data-goes-here" }
}
}
}
For a form post the fields would be named:
session[uuid]=12341234-12341234-1234-1234-123412341234
session[unit_id]=mydevice
session[created]=1234567890
session[saved]=1234567890
session[data][point1]=value1
session[data][point2]=value2
session[data][sketch1][rawData]=base-64-data-goes-here==
session[data][__timezone__]=36000
A successful call will return a JSON response with the session data in the result.
Param name | Description |
---|---|
project_id required |
The project ID number Validations:
|
session[uuid] optional |
The UUID for the session. A random UUID will be created if none is supplied. Validations:
|
session[unit_id] required |
The UnitID for the device that created the session. Validations:
|
session[created] optional |
The unix timestamp for when the session was created. Defaults to the current time if not supplied Validations:
|
session[saved] optional |
The unix timestamp for when the session was saved. Defaults to the current time if not supplied Validations:
|
session[data][<point_name>] optional |
The value for the point given by point_name. This can be a scalar value (string) or a hash with a rawData key for any small amount of embedded binary data. For attachments, this field will be an file uploaded in a mutipart form post. Validations:
|