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​

|||| |------- |---------------------------------------| | URL | https://capture-vintecc.com/api/data | | METHOD | POST |

Headers​

HeaderValue
AuthVersionV0.0.1
DataVersionV0.0.3
Authorization[Bearer / ApiToken] <Received auth token>

Body​

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

info

Each Timestamp is a Unix timestamp in milliseconds (UTC), sent as a JSON number; a numeric string is accepted too. If a metric has no Timestamp, or it is 0, the time the request is received is used.

Field Types​

Primitives​
float "sensor1": 30.0
Int "sensor1": 30
String "sensor1": "30"
Bool "sensor1": true
warning

If a field contains a base64 encoded blob, there is a limit of 1024 bytes. If you need to store larger blobs, link a blobstore and those items will be automatically uploaded to the blobstore.

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": 1585554027000
},
{
"Name": "MeasurementName",
"Tags": {
"SerialNumber": "123457",
"MachineId": "Machine2"
},
"Fields": {
"sensor1": 30
},
"Timestamp": 1585554028000
}
]
}

Result in Database​

timestampSerialNumber (tag)MachineId (tag)sensor1 (field)
1585554027000123456Machine120.0
1585554028000123457Machine230.0

Response​

// TODO