Labels
Labels are the core of Tapp. On this page, we'll dive into the different label endpoints you can use to manage label programmatically. We'll look at how to query, ande update label.
The label model
The label model contains all the information about your labels and their configuration. It also contains an overview of all its events.
Properties
- Name
id- Type
- string
- Description
Document id.
- Name
uid- Type
- string
- Description
Unique id of the label.
- Name
sequenceCode- Type
- string
- Description
Combination of a company shortcode together with the year month and number of the label activated that month. For example FRESH-2401-123 describes a label from FRESH activated in januari 2024 (2401) and this label is the 123rd label for this month.
- Name
created- Type
- timestamp
- Description
Timestamp of when the label was created.
- Name
updated- Type
- timestamp
- Description
Timestamp of when the label was last updated.
- Name
companyId- Type
- string
- Description
A reference to the company that the label belongs to.
- Name
type- Type
- string
- Description
Name of the type of label, examples are: tempSense, humiditySense and shockSense.
- Name
startTime- Type
- number
- Description
Time that the label will start measuring their respective data.
- Name
configTime- Type
- number
- Description
Time when the label was configured.
- Name
elapsedTime- Type
- number
- Description
Time elapsed since the label started measuring data.
- Name
interval- Type
- number
- Description
How much time is in between measurements, given in seconds.
- Name
validConfig- Type
- object
- Description
Object containing the min and max values of the given measuremen, like maxTemperature and minTemperature
- Name
status- Type
- string[]
- Description
An array containing statuses of the label.
- Name
events- Type
- object[]
- Description
An array containing events that happened to the label.
- Name
version- Type
- object
- Description
Object containing information about the versions of the api, firmware and app.
- Name
reference- Type
- string
- Description
Field where a reference can be given.
List all labels
This endpoint allows you to retrieve a paginated list of all your labels. The default page size is 100. For more information on pagination, check out our pagination guide.
Optional attributes
- Name
orderBy- Type
- string
- Description
Order the queried labels.
- Allowed values
createdupdated- Name
order- Type
- string
- Description
Order of the queried labels. Default order is
ASC.
- Allowed values
ASCDESC- Name
startDate- Type
- string
- Description
Start date as date, ISO 8601 date format or timestamp (seconds). For example
YYYY-MM-DD,YYYY-MM-DDT00:00:00ZorSSSSSSSSS.
- Name
endDate- Type
- string
- Description
End date as date, ISO 8601 date format or timestamp (seconds). For example
YYYY-MM-DD,YYYY-MM-DDT00:00:00ZorSSSSSSSSS.
Request
curl -G https://api.tapp.online/v2/labels \
-H "X-API-Key: your-api-key-here" \
-d limit=100
Example response
{
"data": [
{
"Label": {
"uid": "381273996734234828",
"reference": "",
"number": "RICK-2311-1",
"type": "tempSense",
"created": "2023-11-13T10:07:48.162468Z",
"campaign": {
"id": "string",
"coll": "campaigns",
"created": "2023-11-13T09:45:59.199419Z",
"description": "string"
},
"validConfig": {
"minTemperature": 10,
"maxTemperature": 25
},
"configTime": 1697186596,
"startTime": 1700000000,
"interval": 200,
"elapsedTime": 0,
"updated": "2023-11-30T14:46:07.974639Z",
"events": [
{
"timestamp": "2023-11-29T10:13:52.689479Z",
"type": "activateLabel",
"user": {
"id": "381998322700779725",
"coll": "Users",
"ts": "2024-01-10T14:47:53.330Z",
"userId": "c197085b-2ee2−4926−8201−e8719a692788",
"email": "rw@tapp.online"
}
},
{
"timestamp": "2023-11-30T10:13:52.689479Z",
"type": "setParameters",
"user": {
"id": "381998322700779725",
"coll": "Users",
"ts": "2024-01-10T14:47:53.330Z",
"userId": "c197085b-2ee2−4926−8201−e8719a692788",
"email": "rw@tapp.online"
}
}
]
}
}]
}
Retrieve a label
This endpoint allows you to retrieve a specific label by providing their uid.
Optional attributes
- Name
includeTaps- Type
- boolean
- Description
Include the data from all taps of the label in the result. Default value is
false.
Example request
fetch('https://api.tapp.online/v2/labels/:uid?includeTaps=0', {
method: 'GET',
headers: {
'X-API-Key': 'your-api-key-here'
}
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.log('Error:', error))
Example response
{
"id": "string",
"created": "ISO 8601 date",
"updated": "ISO 8601 date",
"uid": "string",
"sequenceCode": "string",
"reference": "string",
"type": "string",
"campaign": {
"id": "string",
"created": "ISO 8601 date",
"description": "string",
},
"validConfig": {
"minTemperature": "number",
"maxTemperature": "number",
"minHumidity": "number",
"maxHumidity": "number"
},
"configTime": "number",
"startTime": "number",
"interval": "number",
"events": [
{
"created": "ISO 8601 date",
"type": "string",
"user": {
"id": "string",
"email": "string"
}
}
]
}
Activate or update a label
This endpoint allows you to either activate or update a label with the included parameters.
Required attributes
- Name
uid- Type
- string
- Description
The uid of the label.
- Name
eventType- Type
- string
- Description
The type of event performed on the label.
- Allowed values
activateddeactivated
Optional attributes
- Name
type- Type
- string
- Description
The type of the label.
- Allowed values
tempSensehumiditySense- Name
reference- Type
- string
- Description
Custom reference of the label.
- Name
configTime- Type
- number
- Description
Epoch timestamp of the configuration time.
- Name
startTime- Type
- number
- Description
Epoch timestamp of the start time, configuration time with potential start DelayNode.
- Name
interval- Type
- number
- Description
Chosen interval
secondsof measurements.
- Name
validConfig- Type
- object
- Description
Object containing minimum and maximum limits for the given label type.
{ "minTemperature": number, "maxTemperature": number, "minHumidity": number, "maxHumidity": number }
- Name
status- Type
- string[]
- Description
An array of the label's statuses.
- Name
version- Type
- object
- Description
Object containing the version number of the label's firmware and its API.
{ "firmwareVersion": string, "firmwareApiVersion": string }
Example request
fetch('https://api.tapp.online/v2/labels/:uid', {
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here'
}
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.log('Error:', error))
Example response
{
"id": "string",
"created": "ISO 8601 date",
"updated": "ISO 8601 date",
"uid": "string",
"sequenceCode": "string",
"reference": "string",
"type": "string",
"campaign": {
"id": "string",
"created": "ISO 8601 date",
"description": "string",
},
"validConfig": {
"minTemperature": "number",
"maxTemperature": "number",
"minHumidity": "number",
"maxHumidity": "number"
},
"configTime": "number",
"startTime": "number",
"interval": "number",
"events": [
{
"created": "ISO 8601 date",
"type": "string",
"user": {
"id": "string",
"email": "string"
}
}
]
}