Skip to main content

Insert Data - JWT token

tip

To be able to insert data, a logger user is needed and a "retention to write" needs to be attached to the logger. (See Capture docs)

Endpoint

URLhttps://capture-vintecc.com/api/data
METHODPOST

Headers

HeaderValue
AuthVersionV0.0.1
DataVersionV0.0.3
Content-Typeapplication/json
AuthorizationBearer <Received auth token>

Body

This is an example with 2 rows of the QualityGradingResults measurement (table) with 1 field (QualityGrade), multiple tags and a timestamp.

At the bottom, we have another timestamp which contains the time of the message itself.

info

Timestamps are specified in UTC time.

Field Types

Primitives
float           "sensor1": 30.0 
Int "sensor1": 30
String "sensor1": "30"
Bool "sensor1": true
Objects
"Defect": {
"X": 250,
"Y": 10000,
"Size-X": 50,
"Size-Y": 100,
}

Objects like the example above will result in flatted fields in the db with integer values.

Defect_XDefect_YDefect_Size-XDefect_Size-Y
2501000050100
Array of objects
 "Defects": [
{
"X": 250,
"Y": 10000,
"Size-X": 50,
"Size-Y": 100,
"#Type": "defect1"
},
{
"X": 300,
"Y": 10000,
"Size-X": 50,
"Size-Y": 100,
"#Type": "defect1"
},
{
"X": 250,
"Y": 10000,
"Size-X": 50,
"Size-Y": 100,
"#Type": "defect2"
}
]

The following example will result in:

Defects_XDefects_YDefects_Size-XDefects_Size-YType (tag)arrIndex (tag)
2501000050100defect10
3001000050100defect11
2501000050100defect22

Because all these equal fields in the array of objects have the same timestamp, we need to add a new tag to make them unique. Therefore we added the arrIndex tag, this tag specifies the position in the array. Another way to create tags with objects or an array of objects is adding # as a prefix before the variable name. In the example above we have the #Type variable which will be added as a tag in the database.

Example

{
"Metrics": [
{
"Name": "MeasurementName",
"Tags": {
"SerialNumber": "123456",
"MachineId": "Machine1"
},
"Fields": {
"sensor1": 20
},
"Timestamp": "1585554027"
},
{
"Name": "MeasurementName",
"Tags": {
"SerialNumber": "123457",
"MachineId": "Machine2"
},
"Fields": {
"sensor1": 30
},
"Timestamp": "1585554028"
}
],
"Timestamp": "1588760160"
}

Result in Database

timestampSerialNumber (tag)MachineId (tag)sensor1 (field)
1585554027123456Machine120.0
1588760160123457Machine230.0

Response

// TODO