Technis API V2
Welcome to the Technis API documentation!
This page will help you get up and running with Technis' GraphQL API. You can learn more about GraphQL here.
Code examples (in javascript) are shown in the dark area on the right.
All requests have to be sent to the GraphQL API endpoint.
API Endpoints
# Production:
https://api-application.technis.com/api/v2/graphql
Getting started
Authentication
If you don't have an API token yet, you'll need to go to the admin panel of the dashboard and create a new token that will allow us to authenticate you during queries.
Then, replace <YOUR_TOKEN_HERE>
in the example to the right with the one you just created in the admin panel.
The server expects for the authorization bearer token to be included in all API requests to the server in a http header.
Playground
You can test the api at our GraphQL V1 Playground or our GraphQL V2 Playground.
{
"Authorization": "Bearer <YOUR_TOKEN_HERE>"
}
Changelog
Date | Changes |
---|---|
2023-08-02 | Create new version of the API |
2023-09-05 | Add getLiveKPIs endpoint |
2023-09-20 | Add getAvailableKPIs endpoint |
2023-10-03 | Update the Glossary and add API chart |
2023-10-04 | Update fields descriptions |
2023-10-24 | Update examples, remove chart, update glossary |
Glossary
Installations, zones and passages
An Installation represents the physical part of the system. It is made up of Zones (which may or may not have sub-zones) connected to each other or to the outside via Passages.
Devices
There are several types of devices supported by V2 KPIs. They can be counting devices (for example cameras or counting mats), or they could also be air quality devices, energy sensors, presence detectors, etc... The list is not exhaustive, and as soon as our team integrate new sensors in the product, they will be available on this API. A device is always linked to a zone or a passage.
KPIs
KPIs are linked either to a Zone a passage or a device. They contain the data from the various sensors transformed into a number. When we integrate new sensor types, we will creat new KPI types, and they will be available in this API V2. You can use the getAvailableKPIs query to get the list of available KPis dor a given zone passage or device.
API V1 and API V2
As we have recently created new KPIs and reworked our calculation method for the metering and air quality KPIs, we have created this second API. This allows you to access the V2 KPI database. So you have two APIs to access your data:
- API V1: to access the first-generation KPIs, as well as informations on installations, events, zones and passages, and finally devices and their status. The available KPI's in this API are the Counting Kpis, and the air quality Kpis only.
- API V2: gives you access to all the second-generation KPIs.
Examples
Here is a list about the most used/useful queries in this API V2.
To get your cartography, zones and passages Ids:
query GetCarto {
getCartographies{
installation {
id
name
}
zones {
id
name
parentIds
childIds
passageIds
}
passages {
id
padIds
name
zoneOutIds
zoneInIds
}
}
}
The answer returned will look like :
"data": {
"getCartographies": [
{
"installation": {
"id": 1,
"name": "Building Simulation"
},
"zones": [
{
"id": 1,
"name": "Building Simulation",
"parentIds": [],
"childIds": [
1,
...
],
"passageIds": [
1
]
},
...
]
"passages": [
{
"id": 1,
"padIds": [
Pad_1,
]
"name": "Building Simulation",
"zoneOutIds": 1,
"zoneInIds": 2
}
...
]
}
]
}
To get your live data :
query GetLiveDataExample {
inside: getLiveKPIs(zoneId: 1, kpiName: INSIDE)
entries: getLiveKPIs(zoneId: 1, kpiName: AFFLUENCE_IN)
}
The answer returned will look like :
{
"data": {
"inside": 35,
"entries": 130
}
}
To get your historical data :
query GetHistoricalDataExample {
getKPIs(zoneId: 1, kpiName : AFFLUENCE_IN,granularity : DAY, dateBegin :"2023-09-20", dateEnd:"2023-09-21")
}
The answer returned will look like :
{
"data": {
"getKPIs": {
"kpiName": "AFFLUENCE_IN",
"timezone": "Europe/Zurich",
"dateBegin": "2023-09-20",
"dateEnd": "2023-09-21",
"granularity": "DAY",
"values": [
{
"value": 3688,
"timestamp": "2023-09-20T00:00:00.000"
},
{
"value": 3197,
"timestamp": "2023-09-21T00:00:00.000"
}
]
}
}
}
To get the list of available Metrics :
query GetMetrics {
getAvailableKPIs(zoneId: 1){
zoneId
kpis {
kpiName
descriptors
}
}
}
The answer returned will look like :
"data": {
"getAvailableKPIs": {
"zoneId": 1,
"kpis": [
{
"kpiName": "AFFLUENCE_IN",
"descriptors": {
"genders": [
"MALE",
"FEMALE",
"UNKNOWN",
"ALL"
],
"ageCategories": [
"CHILD",
"ADULT",
"UNKNOWN",
"ALL"
]
}
}
...
]
}
}
Queries
getAvailableKPIs
Description
Return the available metrics and their descriptors for the selected zone, passage, or device
Response
Returns an AvailableKpis
Example
Query
query GetAvailableKPIs(
$zoneId: Int,
$passageId: Int,
$deviceId: String
) {
getAvailableKPIs(
zoneId: $zoneId,
passageId: $passageId,
deviceId: $deviceId
) {
zoneId
passageId
deviceId
kpis {
kpiName
descriptors
}
}
}
Variables
{
"zoneId": 123,
"passageId": 123,
"deviceId": "abc123"
}
Response
{
"data": {
"getAvailableKPIs": {
"zoneId": 987,
"passageId": 123,
"deviceId": "abc123",
"kpis": [AvailableKpi]
}
}
}
getCartographies
Response
Returns [CartographyOpenV2]
Example
Query
query GetCartographies {
getCartographies {
installation {
id
name
country
city
postCode
address
img
organizationId
deleted
timezone
metrics
creationDate
processingTaskTypes
generateLegacyKpis
resetAtChangeOfDay
totalSensors
totalZones
totalPassages
}
zones {
id
name
installationId
parentIds
childIds
passageIds
countMinMax
msgFull
msgEmpty
deleted
capacity
surface
_id
tags {
id
name
categoryId
organizationId
_id
tags {
...TagChildFragment
}
}
}
passages {
id
installationId
padIds
name
zoneOutIds
zoneInIds
deleted
_id
tags {
id
name
categoryId
organizationId
_id
tags {
...TagChildFragment
}
}
}
users {
id
createdAt
role
phone
lang
email
accessIds
rightIds
organizationIds
tokenId
maxApiCredits
apiCreditsPerMin
apiCredits
showStatuses
isEmailVerified
isPhoneVerified
theme
timezone
timeFormat
picture
isActive
productUsage
firstName
lastName
profileId
hasStartedTutorial
pinnedUrls {
id
url
title
target
order
_id
}
_id
otpContact
dateFormat
name
metrics
apiKeys {
key
dateLastUse
dateCreated
}
}
}
}
Response
{
"data": {
"getCartographies": [
{
"installation": InstallationOpen,
"zones": [CartographyV2Zone],
"passages": [CartographyV2Passage],
"users": [User]
}
]
}
}
getKPIs
Description
Return the values for the selected metric of the selected zone, passage, or device
Response
Returns a JSON
Arguments
Name | Description |
---|---|
zoneId - Int
|
Id of the zone allowing to select the data |
passageId - Int
|
Id of the passage allowing to select the data |
deviceId - String
|
Id of the device allowing to select the data |
kpiName - RetailMetrics!
|
The nature of the data that should be requested |
timezone - String
|
Timezone of the installation in which the sensor, passage or zone is |
granularity - Granularities
|
The granularity of the data requested, defaults to DAY. Default = DAY |
dateBegin - String!
|
Format: YYYY-MM-DD |
dateEnd - String!
|
Format: YYYY-MM-DD |
descriptors - DescriptorsInput
|
List of descriptors to apply to the data requested |
Example
Query
query GetKPIs(
$zoneId: Int,
$passageId: Int,
$deviceId: String,
$kpiName: RetailMetrics!,
$timezone: String,
$granularity: Granularities,
$dateBegin: String!,
$dateEnd: String!,
$descriptors: DescriptorsInput
) {
getKPIs(
zoneId: $zoneId,
passageId: $passageId,
deviceId: $deviceId,
kpiName: $kpiName,
timezone: $timezone,
granularity: $granularity,
dateBegin: $dateBegin,
dateEnd: $dateEnd,
descriptors: $descriptors
)
}
Variables
{
"zoneId": 987,
"passageId": 123,
"deviceId": "xyz789",
"kpiName": "DWELL",
"timezone": "xyz789",
"granularity": "DAY",
"dateBegin": "xyz789",
"dateEnd": "xyz789",
"descriptors": DescriptorsInput
}
Response
{"data": {"getKPIs": {}}}
getLiveKPIs
Description
Return the live value for the selected metric for of the selected zone, passage, or device
Response
Returns a JSON
Arguments
Name | Description |
---|---|
zoneId - Int
|
Id of the zone allowing to select the data |
passageId - Int
|
Id of the passage allowing to select the data |
deviceId - String
|
Id of the device allowing to select the data |
kpiName - RetailMetrics!
|
The nature of the data that should be requested |
Example
Query
query GetLiveKPIs(
$zoneId: Int,
$passageId: Int,
$deviceId: String,
$kpiName: RetailMetrics!
) {
getLiveKPIs(
zoneId: $zoneId,
passageId: $passageId,
deviceId: $deviceId,
kpiName: $kpiName
)
}
Variables
{
"zoneId": 987,
"passageId": 987,
"deviceId": "xyz789",
"kpiName": "DWELL"
}
Response
{"data": {"getLiveKPIs": {}}}
Types
ApiKey
AvailableKpi
Description
List of all available kpi types with their descriptors.
Fields
Field Name | Description |
---|---|
kpiName - RetailMetrics
|
Available kpi. |
descriptors - JSON
|
List of descriptors. |
Example
{"kpiName": "DWELL", "descriptors": {}}
AvailableKpis
Description
Zone, passage or device ID, and its associated available Kpi list and descriptors.
Fields
Field Name | Description |
---|---|
zoneId - Int
|
Id of the selected zone. |
passageId - Int
|
Id of the selected passage. |
deviceId - String
|
Id of the selected device. |
kpis - [AvailableKpi]
|
List of all available kpi types with their descriptors. |
Example
{
"zoneId": 987,
"passageId": 987,
"deviceId": "xyz789",
"kpis": [AvailableKpi]
}
Boolean
Description
The Boolean
scalar type represents true
or false
.
Example
true
CartographyOpenV2
Fields
Field Name | Description |
---|---|
installation - InstallationOpen
|
Infos about this installation. |
zones - [CartographyV2Zone]
|
List of zones in this installation. |
passages - [CartographyV2Passage]
|
List of passages in this installation. |
users - [User]
|
List of users that can access this installation. |
Example
{
"installation": InstallationOpen,
"zones": [CartographyV2Zone],
"passages": [CartographyV2Passage],
"users": [User]
}
CartographyV2Passage
Fields
Field Name | Description |
---|---|
id - Float
|
Passage's ID. |
installationId - Float
|
Installation's Id in which the passage is. |
padIds - [String]
|
Related Pads ID's. |
name - String
|
Passage's name. |
zoneOutIds - [Float]
|
ID of the Zones for which the passage counts an exit (out) when somebody walks on the pads. |
zoneInIds - [Float]
|
ID of the Zones for which the passage counts an entry (in) when somebody walks on the pads. |
deleted - Boolean
|
Whether the passage is deleted. |
_id - MongoID!
|
|
tags - [Tag]
|
List of tags attached to the zones |
Example
{
"id": 123.45,
"installationId": 987.65,
"padIds": ["abc123"],
"name": "abc123",
"zoneOutIds": [123.45],
"zoneInIds": [987.65],
"deleted": true,
"_id": MongoID,
"tags": [Tag]
}
CartographyV2Zone
Fields
Field Name | Description |
---|---|
id - Float
|
Zone's ID. |
name - String
|
Zone's name. |
installationId - Float
|
Related installation's ID. |
parentIds - [Float]
|
Parent zone ID. |
childIds - [Float]
|
Children zones ID's. |
passageIds - [Float]
|
Related passages ID's. |
countMinMax - [Float]
|
Range that forces the zone's count to stay within. |
msgFull - String
|
|
msgEmpty - String
|
|
deleted - Boolean
|
Whether the zone is deleted. |
capacity - Float
|
Capacity of the zone. |
surface - Float
|
In square meters (m²) |
_id - MongoID!
|
|
tags - [Tag]
|
List of tags attached to the zone |
Example
{
"id": 123.45,
"name": "xyz789",
"installationId": 123.45,
"parentIds": [987.65],
"childIds": [123.45],
"passageIds": [123.45],
"countMinMax": [987.65],
"msgFull": "xyz789",
"msgEmpty": "abc123",
"deleted": false,
"capacity": 987.65,
"surface": 123.45,
"_id": MongoID,
"tags": [Tag]
}
Date
Example
"2007-12-03"
DescriptorAgecategories
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
Example
"CHILD"
DescriptorCombustibletypes
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
Example
"ALL"
DescriptorElecdestinations
Values
Enum Value | Description |
---|---|
|
|
|
|
|
Example
"ALL"
DescriptorElecorigins
Values
Enum Value | Description |
---|---|
|
|
|
|
|
Example
"ALL"
DescriptorEngaged
Values
Enum Value | Description |
---|---|
|
|
|
|
|
Example
"ALL"
DescriptorGenders
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
Example
"MALE"
DescriptorGroupsizes
Values
Enum Value | Description |
---|---|
|
|
|
|
|
Example
"ALL"
DescriptorWatertemperatures
Values
Enum Value | Description |
---|---|
|
|
|
|
|
Example
"ALL"
DescriptorsInput
Fields
Input Field | Description |
---|---|
ageCategories - [DescriptorAgecategories]
|
|
engaged - [DescriptorEngaged]
|
|
genders - [DescriptorGenders]
|
|
groupSizes - [DescriptorGroupsizes]
|
|
elecOrigins - [DescriptorElecorigins]
|
|
elecDestinations - [DescriptorElecdestinations]
|
|
combustibleTypes - [DescriptorCombustibletypes]
|
|
waterTemperatures - [DescriptorWatertemperatures]
|
|
elecUses - [String]
|
|
waterUses - [String]
|
|
combustibleUses - [String]
|
Example
{
"ageCategories": ["CHILD"],
"engaged": ["ALL"],
"genders": ["MALE"],
"groupSizes": ["ALL"],
"elecOrigins": ["ALL"],
"elecDestinations": ["ALL"],
"combustibleTypes": ["ALL"],
"waterTemperatures": ["ALL"],
"elecUses": ["xyz789"],
"waterUses": ["xyz789"],
"combustibleUses": ["abc123"]
}
EnumInstallationDataUserPinnedUrlsTarget
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
Example
"_top"
EnumInstallationMetrics
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
Example
"counting"
EnumUserLang
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
Example
"it"
EnumUserRole
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
"stock"
EnumUserTheme
Values
Enum Value | Description |
---|---|
|
|
|
Example
"light"
EventMetrics
Values
Enum Value | Description |
---|---|
|
|
|
Example
"counting"
Float
Description
The Float
scalar type represents signed double-precision fractional values as specified by IEEE 754.
Example
987.65
Granularities
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
"DAY"
InstallationDataUserPinnedUrls
InstallationOpen
Description
Format of an installation. It contains :
- the informations on this installation
- the events related to this installation
- the zones of this installation
Fields
Field Name | Description |
---|---|
id - Float
|
Installation's ID. |
name - String
|
Installation's name. |
country - String
|
Installation's country. |
city - String
|
City's name in which the installation is located. |
postCode - String
|
postCode's in which the installation is located. |
address - String
|
Installation's full address. |
img - String
|
URL for an image that represents the installation. |
organizationId - Float
|
Organization's id linked to the installation. |
deleted - Boolean
|
Whether the installation is deleted. |
timezone - String
|
Timezone in which the installation is located. |
metrics - [EnumInstallationMetrics]
|
List of metrics supported by the installation. |
creationDate - Float
|
Creation date of the installation. |
processingTaskTypes - [String]
|
|
generateLegacyKpis - Boolean
|
|
resetAtChangeOfDay - Boolean
|
|
totalSensors - Int
|
The total number of sensors set used in this installation. |
totalZones - Int
|
The total number of zones in this installation. |
totalPassages - Int
|
The total number of passages in this installation. |
Example
{
"id": 123.45,
"name": "abc123",
"country": "xyz789",
"city": "abc123",
"postCode": "xyz789",
"address": "abc123",
"img": "abc123",
"organizationId": 123.45,
"deleted": true,
"timezone": "xyz789",
"metrics": ["counting"],
"creationDate": 123.45,
"processingTaskTypes": ["abc123"],
"generateLegacyKpis": true,
"resetAtChangeOfDay": false,
"totalSensors": 123,
"totalZones": 987,
"totalPassages": 123
}
Int
Description
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
Example
987
JSON
Description
The JSON
scalar type represents JSON values as specified by ECMA-404.
Example
{}
MongoID
Description
The ID
scalar type represents a unique MongoDB identifier in collection. MongoDB by default use 12-byte ObjectId value (https://docs.mongodb.com/manual/reference/bson-types/#objectid). But MongoDB also may accepts string or integer as correct values for _id field.
Example
MongoID
OtpContactType
Values
Enum Value | Description |
---|---|
|
|
|
Example
"email"
RetailMetrics
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
"DWELL"
String
Description
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
Example
"abc123"
Tag
Example
{
"id": "xyz789",
"name": "xyz789",
"categoryId": "abc123",
"organizationId": 123.45,
"_id": MongoID,
"tags": [TagChild]
}
TagChild
User
Fields
Field Name | Description |
---|---|
id - String
|
User ID. |
createdAt - Date
|
|
role - EnumUserRole
|
|
phone - String
|
User phone. |
lang - EnumUserLang
|
|
email - String
|
User email. |
accessIds - [Float]
|
|
rightIds - [Float]
|
|
organizationIds - [Float]
|
|
tokenId - String
|
|
maxApiCredits - Float
|
|
apiCreditsPerMin - Float
|
|
apiCredits - Float
|
|
showStatuses - Boolean
|
|
isEmailVerified - Boolean
|
|
isPhoneVerified - Boolean
|
|
theme - EnumUserTheme
|
|
timezone - String
|
|
timeFormat - String
|
|
picture - String
|
|
isActive - Boolean
|
|
productUsage - String
|
|
firstName - String
|
User first name. |
lastName - String
|
User last name. |
profileId - Float
|
|
hasStartedTutorial - Boolean
|
Whether the user has already started the tutorial at least once |
pinnedUrls - [InstallationDataUserPinnedUrls]
|
|
_id - MongoID!
|
|
otpContact - OtpContactType
|
|
dateFormat - String
|
Authorized values: ["DD/MM/YYYY", "MM/DD/YYYY", "YYYY/MM/DD", "YYYY-MM-DD"] |
name - String
|
User name. |
metrics - EventMetrics
|
|
apiKeys - [ApiKey]
|
Example
{
"id": "xyz789",
"createdAt": "2007-12-03",
"role": "stock",
"phone": "xyz789",
"lang": "it",
"email": "xyz789",
"accessIds": [987.65],
"rightIds": [987.65],
"organizationIds": [123.45],
"tokenId": "abc123",
"maxApiCredits": 123.45,
"apiCreditsPerMin": 123.45,
"apiCredits": 987.65,
"showStatuses": false,
"isEmailVerified": true,
"isPhoneVerified": false,
"theme": "light",
"timezone": "abc123",
"timeFormat": "xyz789",
"picture": "xyz789",
"isActive": true,
"productUsage": "abc123",
"firstName": "abc123",
"lastName": "abc123",
"profileId": 987.65,
"hasStartedTutorial": false,
"pinnedUrls": [InstallationDataUserPinnedUrls],
"_id": MongoID,
"otpContact": "email",
"dateFormat": "xyz789",
"name": "abc123",
"metrics": "counting",
"apiKeys": [ApiKey]
}