Insert Data - JWT token
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
Header | Value |
---|---|
AuthVersion | V0.0.1 |
DataVersion | V0.0.3 |
Content-Type | application/json |
Authorization | Bearer <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.
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_X | Defect_Y | Defect_Size-X | Defect_Size-Y |
---|---|---|---|
250 | 10000 | 50 | 100 |
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_X | Defects_Y | Defects_Size-X | Defects_Size-Y | Type (tag) | arrIndex (tag) |
---|---|---|---|---|---|
250 | 10000 | 50 | 100 | defect1 | 0 |
300 | 10000 | 50 | 100 | defect1 | 1 |
250 | 10000 | 50 | 100 | defect2 | 2 |
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
timestamp | SerialNumber (tag) | MachineId (tag) | sensor1 (field) |
---|---|---|---|
1585554027 | 123456 | Machine1 | 20.0 |
1588760160 | 123457 | Machine2 | 30.0 |
Response
// TODO