leantegra-rest-api v0.0.0
Leantegra REST API
Browser and node module for making API requests against Leantegra REST API.
Please note: This module uses Popsicle to make API requests. Promises must be supported or polyfilled on all target environments.
Installation
npm install leantegra-rest-api --save
bower install leantegra-rest-api --save
Usage
Node
var LeantegraRestApi = require('leantegra-rest-api');
var client = new LeantegraRestApi();
Browsers
<script src="leantegra-rest-api/index.js">
<script>
var client = new window.LeantegraRestApi();
</script>
Authentication
OAuth 2.0
This API supports authentication with OAuth 2.0. Initialize the OAuth2
instance with the application client id, client secret and a redirect uri to authenticate with users.
var auth = new LeantegraRestApi.OAuth2({
clientId: '123',
clientSecret: 'abc',
redirectUri: 'http://example.com/auth/callback'
});
All getToken()
calls are asynchronous and return promise objects which resolve to an access token instance.
Resource Owner Password Credentials Grant
- Make a direct request for the access token on behalf of the user using
auth.owner.getToken(username, password)
.
Client Credentials Grant
- Get the access token for the application by using
auth.credentials.getToken()
.
Access Tokens
Access token instances can be manually re-created. This is critical for access token reuse, such as saving credentials to a database for reusing later in the codebase.
var token = auth.createToken('access token', 'refresh token');
An access token instance (manually created or automatically generated by a getToken()
method) can be passed into any API request. This will sign the API request with the current users access token credentials.
// Existing API client instance.
client.resource('/').get(null, {
user: token
});
// New API client instance.
var client = new LeantegraRestApi({
user: token
});
Options
You can set options when you initialize a client or at any time with the options
property. You may also override options for a single request by passing an object as the second argument of any request method. For example:
var client = new LeantegraRestApi({ ... });
client.options = { ... };
client.resource('/').get(null, {
baseUri: 'http://example.com',
headers: {
'Content-Type': 'application/json'
}
});
Base URI
You can override the base URI by setting the baseUri
property, or initializing a client with a base URI. For example:
new LeantegraRestApi({
baseUri: 'https://example.com'
});
Base URI Parameters
If the base URI has parameters inline, you can set them by updating the baseUriParameters
property. For example:
client.options.baseUriParameters.version = 'v1';
Resources
All methods return a HTTP request instance of Popsicle, which allows the use of promises (and streaming in node).
resources.analytics.queries.dwellTime
A dwell-time query - returns amount of average dwell time (in seconds) per location.
var resource = client.resources.analytics.queries.dwellTime;
GET
A dwell-time query - returns amount of average dwell time (in seconds) per location.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- locations string
A comma separated list of locations to be filtered by in a query. If this parameter is omitted then all locations, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.queries.newReturned
A new-returned query - returns amount of unique new and returned visitors per location.
var resource = client.resources.analytics.queries.newReturned;
GET
A new-returned query - returns amount of unique new and returned visitors per location.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- locations string
A comma separated list of locations to be filtered by in a query. If this parameter is omitted then all locations, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.queries.visitorsPassersby
A visitors-passersby query - returns amount of unique visitors and passerbys per location.
var resource = client.resources.analytics.queries.visitorsPassersby;
GET
A visitors-passersby query - returns amount of unique visitors and passerbys per location.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- locations string
A comma separated list of locations to be filtered by in a query. If this parameter is omitted then all locations, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.queries.popularity
A location popularity query - returns popularity (amount of unique visitors) per location.
var resource = client.resources.analytics.queries.popularity;
GET
A location popularity query - returns popularity (amount of unique visitors) per location.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- locations string
A comma separated list of locations to be filtered by in a query. If this parameter is omitted then all locations, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.queries.campaigns
A campaign statistic query - returns number of opened and received contents for the given campaign.
var resource = client.resources.analytics.queries.campaigns;
GET
A campaign statistic query - returns number of opened and received contents for the given campaign.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- campaigns string
A comma separated list of campaigns to be filtered by in a query. If this parameter is omitted then all campaigns, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.queries.rules
A rule statistic query - returns number of opened and received contents for the given rule.
var resource = client.resources.analytics.queries.rules;
GET
A rule statistic query - returns number of opened and received contents for the given rule.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- rules string
A comma separated list of campaigns to be filtered by in a query. If this parameter is omitted then all campaigns, which are allowed to requested user, are used.
- interval string
A comma separated list that contains exactly two dates in ISO-8601 format. Both values must have same timezone and the first date must be before the second date.
- granularity string
An ISO-8601 duration string that represents granularity of a query.
- order string, one of (asc, desc), default: asc
An order of returned data. If not provided then "asc" order is used.
- limit number
A limit of returned count of records
resources.analytics.timeBoundaries
var resource = client.resources.analytics.timeBoundaries;
GET
Returns availiable for querying time boundaries for the provided metric
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- metric string, one of (visitors-passersby, popularity, dwell-time, new-returned), default: visitors-passersby
resources.cms.contents.videos
Module for working with URL content
var resource = client.resources.cms.contents.videos;
GET
resource.get().then(function (res) { ... });
POST
Creates new URL content in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "originalFilename", "notification",
"url", "disposable", "size"],
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"originalFilename": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"url": {
"type": "string",
"format": "uri"
},
"size": {
"type": "number",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 64
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
resources.cms.contents.videos.uid(uid)
- uid string
var resource = client.resources.cms.contents.videos.uid(uid);
DELETE
Deletes the URL content
resource.delete().then(function (res) { ... });
PATCH
Updates the URL content
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"originalFilename": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"url": {
"type": "string",
"format": "uri"
},
"size": {
"type": "number",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 64
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
GET
Returns URL content by its uid
resource.get().then(function (res) { ... });
resources.cms.contents.images
Module for working with image content
var resource = client.resources.cms.contents.images;
GET
resource.get().then(function (res) { ... });
POST
Creates new image content in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "notification", "url", "size",
"originalFilename"],
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"originalFilename": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"url": {
"type": "string",
"format": "uri"
},
"size": {
"type": "number",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
resources.cms.contents.images.uid(uid)
- uid string
var resource = client.resources.cms.contents.images.uid(uid);
DELETE
Deletes the image content
resource.delete().then(function (res) { ... });
PATCH
Updates the image content
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"originalFilename": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"url": {
"type": "string",
"format": "uri"
},
"size": {
"type": "number",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 60
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
GET
Returns image content by its uid
resource.get().then(function (res) { ... });
resources.cms.contents.urls
Module for working with image content
var resource = client.resources.cms.contents.urls;
GET
resource.get().then(function (res) { ... });
POST
Creates new image content in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "notification", "disposable",
"url"],
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"url": {
"type": "string",
"format": "uri",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 64
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"preserveUrl": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
resources.cms.contents.urls.uid(uid)
- uid string
var resource = client.resources.cms.contents.urls.uid(uid);
DELETE
Deletes the image content
resource.delete().then(function (res) { ... });
PATCH
Updates the image content
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 128
},
"url": {
"type": "string",
"format": "uri",
"maxLength": 2000
},
"categories": {
"type": "array",
"items": {
"type": "number"
}
},
"notification": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 64
},
"couponId": {
"type": "string"
},
"disposable": {
"type": "boolean"
},
"preserveUrl": {
"type": "boolean"
},
"notificationLong": {
"type": "string",
"maxLength": 256
},
"barcode": {
"type": "string",
"maxLength": 256
},
"itemNumber": {
"type": "string",
"maxLength": 256
},
"sticker": {
"type": "string",
"maxLength": 256
},
"price": {
"type": "string",
"maxLength": 256
}
}
}
GET
Returns image content by its uid
resource.get().then(function (res) { ... });
resources.cms.statuses.campaigns
Module for obtaining infomration about statuses of campaigns and rules
var resource = client.resources.cms.statuses.campaigns;
GET
resource.get().then(function (res) { ... });
resources.cms.categories
Module for working with content categories
var resource = client.resources.cms.categories;
GET
resource.get().then(function (res) { ... });
POST
Creates new content category in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
}
}
resources.cms.categories.uid(uid)
- uid string
var resource = client.resources.cms.categories.uid(uid);
DELETE
Deletes the content category
resource.delete().then(function (res) { ... });
PATCH
Updates the content category
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
}
}
GET
Returns content category by its uid
resource.get().then(function (res) { ... });
resources.cms.campaigns
Module for working with CMS campaign
var resource = client.resources.cms.campaigns;
GET
resource.get().then(function (res) { ... });
POST
Creates new CMS campaign in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "disabled", "startDate", "endDate"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"disabled": {
"type": "boolean"
},
"startDate": {
"type": "string",
"format": "date-time"
},
"endDate": {
"type": "string",
"format": "date-time"
}
}
}
resources.cms.campaigns.uid(uid)
- uid string
var resource = client.resources.cms.campaigns.uid(uid);
DELETE
Deletes the CMS campaign
resource.delete().then(function (res) { ... });
PATCH
Updates the CMS campaign
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"disabled": {
"type": "boolean"
},
"startDate": {
"type": "string",
"format": "date-time"
},
"endDate": {
"type": "string",
"format": "date-time"
}
}
}
GET
Returns CMS campaign by its uid
resource.get().then(function (res) { ... });
resources.cms.rules
Module for working with CMS rule
var resource = client.resources.cms.rules;
GET
resource.get().then(function (res) { ... });
POST
Creates new CMS rule in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"name",
"content",
"event",
"campaign",
"powermoteOrGroup",
"disabled",
"frequency",
"scheduleDays",
"scheduleTimeStart",
"scheduleTimeEnd"
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"content": {
"type": "number",
"description": "uid of the content that could be created in /cms/contents"
},
"display": {
"type": "array",
"items": {
"type": "string",
"enum": ["In offer list", "As push notification", "Appless"]
}
},
"gender": {
"type": "string",
"enum": [
"Male",
"Female",
"Any"
]
},
"minAge": {
"type": "number",
"minimum": 0
},
"maxAge": {
"type": "number",
"minimum": 0
},
"event": {
"enum": [
"On Enter to Far",
"From Far to Near",
"From Near to Immediate",
"From Immediate to Near",
"From Near to Far",
"From Far to Exit",
"Dwell Time in Far",
"Dwell Time in Near",
"Dwell Time in Immediate"
]
},
"duration": {
"type": "number",
"minimum": 0
},
"campaign": {
"type": "number",
"decsription": "uid of the campaign to which this rule is attached"
},
"powermoteOrGroup": {
"type": "number",
"description": "uid of the PowerMote or the Group of powermotes"
},
"disabled": {
"type": "boolean"
},
"segment": {
"type": [
"number",
"null"
]
},
"frequency": {
"enum": [
"Always",
"Only once",
"Once every"
]
},
"scheduleDays": {
"type": "array",
"items": {
"enum": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
]
}
},
"scheduleTimeStart": {
"description": "Amount of milliseconds elapsed from the beginning of the day",
"type": "number"
},
"scheduleTimeEnd": {
"description": "Amount of milliseconds elapsed from the beginning of the day",
"type": "number"
},
"onceEvery": {
"description": "One of the following ISO 8601 duration objects",
"enum": [
"PT10M",
"PT30M",
"PT1H",
"P1D",
"P7D",
"P1M"
]
},
"languages": {
"type": "array",
"items": {
"type": "string",
"description": "ISO 639-2 Language Code",
"minLength": 2,
"maxLength": 2
}
}
}
}
resources.cms.rules.uid(uid)
- uid string
var resource = client.resources.cms.rules.uid(uid);
DELETE
Deletes the CMS rule
resource.delete().then(function (res) { ... });
PATCH
Updates the CMS rule
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"content": {
"type": "number",
"description": "uid of the content that could be created in /cms/contents"
},
"display": {
"type": "array",
"items": {
"type": "string",
"enum": ["In offer list", "As push notification", "Appless"]
}
},
"gender": {
"type": "string",
"enum": [
"Male",
"Female",
"Any"
]
},
"minAge": {
"type": "number",
"minimum": 0
},
"maxAge": {
"type": "number",
"minimum": 0
},
"event": {
"enum": [
"On Enter to Far",
"From Far to Near",
"From Near to Immediate",
"From Immediate to Near",
"From Near to Far",
"From Far to Exit",
"Dwell Time in Far",
"Dwell Time in Near",
"Dwell Time in Immediate"
]
},
"duration": {
"type": "number",
"minimum": 0
},
"campaign": {
"type": "number",
"decsription": "uid of the campaign to which this rule is attached"
},
"powermoteOrGroup": {
"type": "number",
"description": "uid of the PowerMote or the Group of powermotes"
},
"disabled": {
"type": "boolean"
},
"segment": {
"type": [
"number",
"null"
]
},
"frequency": {
"enum": [
"Always",
"Only once",
"Once every"
]
},
"scheduleDays": {
"type": "array",
"items": {
"enum": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
]
}
},
"scheduleTimeStart": {
"description": "Amount of milliseconds elapsed from the beginning of the day",
"type": "number"
},
"scheduleTimeEnd": {
"description": "Amount of milliseconds elapsed from the beginning of the day",
"type": "number"
},
"onceEvery": {
"description": "One of the following ISO 8601 duration objects",
"enum": [
"PT10M",
"PT30M",
"PT1H",
"P1D",
"P7D",
"P1M"
]
},
"languages": {
"type": "array",
"items": {
"type": "string",
"description": "ISO 639-2 Language Code",
"minLength": 2,
"maxLength": 2
}
}
}
}
GET
Returns CMS rule by its uid
resource.get().then(function (res) { ... });
resources.cms.rules.uid(uid).info
var resource = client.resources.cms.rules.uid(uid).info;
GET
Returns CMS rule info by its uid
resource.get().then(function (res) { ... });
resources.cms.snapshots
Module for working with CMS rule
var resource = client.resources.cms.snapshots;
GET
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- url string
URL of the website for the image snapshot
resources.trackables.assets
Module for working with Trackable Assets
var resource = client.resources.trackables.assets;
GET
Returns list of all Trackable Assets present in the system
resource.get().then(function (res) { ... });
POST
Creates new Trackable Asset in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"powerMoteSerialNumber": {
"type": "number",
"description": "UID of WiBeat serial number entity"
},
"picture": {
"type": "string",
"maxLength": 2000
},
"note": {
"type": "string",
"maxLength": 512
},
"supervisor": {
"type": "string",
"maxLength": 128
},
"department": {
"type": "string",
"maxLength": 128
}
}
}
resources.trackables.assets.uid(uid)
- uid string
var resource = client.resources.trackables.assets.uid(uid);
DELETE
Deletes the Trackable Asset
resource.delete().then(function (res) { ... });
PATCH
Updates the Trackable Asset
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"powerMoteSerialNumber": {
"type": "number",
"description": "UID of WiBeat serial number entity"
},
"picture": {
"type": "string",
"maxLength": 2000
},
"note": {
"type": "string",
"maxLength": 512
},
"supervisor": {
"type": "string",
"maxLength": 128
},
"department": {
"type": "string",
"maxLength": 128
}
}
}
GET
Returns Trackable Asset by its uid
resource.get().then(function (res) { ... });
resources.trackables.persons
Module for working with Trackable Persons
var resource = client.resources.trackables.persons;
GET
Returns list of all Trackable Persons present in the system
resource.get().then(function (res) { ... });
POST
Creates new Trackable Person in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "lastName"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"lastName": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"email": {
"type": "string",
"pattern":"^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$",
"description": "Email. Case insensitive."
},
"phone":{
"pattern":"^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type":"string",
"minLength":1,
"maxLength":32
},
"powerMoteSerialNumber": {
"type": "number",
"description": "UID of WiBeat serial number entity"
},
"picture": {
"type": "string",
"maxLength": 2000
},
"note": {
"type": "string",
"maxLength": 512
},
"supervisor": {
"type": "string",
"maxLength": 128
},
"department": {
"type": "string",
"maxLength": 128
}
}
}
resources.trackables.persons.uid(uid)
- uid string
var resource = client.resources.trackables.persons.uid(uid);
DELETE
Deletes the Trackable Person
resource.delete().then(function (res) { ... });
PATCH
Updates the Trackable Person
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"lastName": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"email": {
"type": "string",
"pattern":"^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$",
"description": "Email. Case insensitive."
},
"phone":{
"pattern":"^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type":"string",
"minLength":1,
"maxLength":32
},
"powerMoteSerialNumber": {
"type": "number",
"description": "UID of WiBeat serial number entity"
},
"picture": {
"type": "string",
"maxLength": 2000
},
"note": {
"type": "string",
"maxLength": 512
},
"supervisor": {
"type": "string",
"maxLength": 128
},
"department": {
"type": "string",
"maxLength": 128
}
}
}
GET
Returns Trackable Person by its uid
resource.get().then(function (res) { ... });
resources.files.cms
var resource = client.resources.files.cms;
POST
Uploads file to the sytsem. Every file has expiration date that's equal to at least 30 minutes - if it occurs and file is not attached to any content entity then it's removed from the system.
resource.post().then(function (res) { ... });
Query Parameters
resource.post(null, { query: { ... } });
- rotation number
Angel of rotation to apply to image.
Body
multipart/form-data
{ "file": { "description": "The file to be uploaded", "required": true, "type": "file", "displayName": "file" } }
resources.files.floors
var resource = client.resources.files.floors;
POST
Uploads floor background image to the system. Every file has expiration date that's equal to at least 30 minutes - if it occurs and file is not attached to any floor entity then it's removed from the system.
resource.post().then(function (res) { ... });
Query Parameters
resource.post(null, { query: { ... } });
- rotation number
Angel of rotation to apply to image.
Body
multipart/form-data
{ "file": { "description": "The file to be uploaded", "required": true, "type": "file", "displayName": "file" } }
resources.files.trackables
var resource = client.resources.files.trackables;
POST
Uploads file to the sytsem. Every file has expiration date that's equal to at least 30 minutes - if it occurs and file is not attached to any trackables entity then it's removed from the system.
resource.post().then(function (res) { ... });
Query Parameters
resource.post(null, { query: { ... } });
- rotation number
Angel of rotation to apply to image.
Body
multipart/form-data
{ "file": { "description": "The file to be uploaded", "required": true, "type": "file", "displayName": "file" } }
resources.devices.serialnumbers.powerbeacons
Module for working with serial numbers for PowerBeacons
var resource = client.resources.devices.serialnumbers.powerbeacons;
GET
Returns list of all serial numbers for PowerBeacons
resource.get().then(function (res) { ... });
POST
Imports a batch of serial numbers for PowerBeacons
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type":"object",
"additionalProperties":false,
"required":["value", "mac"],
"properties":{
"value":{
"type":"string",
"description":"Value of the serial number"
},
"mac": {
"type": "string",
"description": "Mac address of the PowerBeacon device"
}
}
}
}
multipart/form-data
{ "file": { "description": "The file to be uploaded in csv or json format", "required": true, "type": "file", "example": "value,mac\r\nA305000013681111121,56:56:88:60:63:D7\nA305000013681111122,56:56:88:60:63:D8\n", "displayName": "file" } }
resources.devices.serialnumbers.powerbeacons.uid(uid)
- uid string
var resource = client.resources.devices.serialnumbers.powerbeacons.uid(uid);
GET
Returns information about serial number by the given uid
resource.get().then(function (res) { ... });
DELETE
Deletes serial number by the given uid
resource.delete().then(function (res) { ... });
resources.devices.serialnumbers.powermotes
Module for working with serial numbers for PowerMotes
var resource = client.resources.devices.serialnumbers.powermotes;
GET
Returns list of all serial numbers for PowerMotes
resource.get().then(function (res) { ... });
POST
Imports a batch of serial numbers for PowerMotes
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"value",
"mac",
"type"
],
"properties": {
"value": {
"type": "string",
"description": "Value of the serial number"
},
"mac": {
"type": "string",
"description": "Mac address of the PowerBeacon device"
},
"type": {
"enum": [
"ble",
"uwb"
]
},
"uuid": {
"type": "string",
"description": "UUID of the PowerMote"
},
"major": {
"type": "number",
"description": "Major version of the PowerMote"
},
"minor": {
"type": "number",
"description": "Minor version of the PowerMote"
},
"standalone": {
"type": "boolean"
}
}
}
}
multipart/form-data
{ "file": { "description": "The file to be uploaded in csv or json format", "required": true, "type": "file", "example": "value,mac,type,major,minor,uuid,standalone\nA305000013681111121,56:56:88:60:63:D7,ble,1,368,85a99e33-bbbe-4763-a66b-4d3a3edec09b,true\nA305000013681111122,56:56:88:60:63:D8,ble,1,369,85a99e33-bbbe-4763-a66b-4d3a3edec09b,false\n", "displayName": "file" } }
resources.devices.serialnumbers.powermotes.uid(uid)
- uid string
var resource = client.resources.devices.serialnumbers.powermotes.uid(uid);
GET
Returns information about serial number by the given uid
resource.get().then(function (res) { ... });
DELETE
Deletes serial number by the given uid
resource.delete().then(function (res) { ... });
resources.devices.serialnumbers.powergates
Module for working with serial numbers for PowerGates
var resource = client.resources.devices.serialnumbers.powergates;
GET
Returns list of all serial numbers for PowerGates
resource.get().then(function (res) { ... });
POST
Imports a batch of serial numbers for PowerGates
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type":"object",
"additionalProperties":false,
"required":["value"],
"properties":{
"value":{
"type":"string",
"description":"Value of the serial number"
}
}
}
}
multipart/form-data
{ "file": { "description": "The file to be uploaded in csv or json format", "required": true, "type": "file", "example": "value\nPG00000000001\nPG00000000002\n", "displayName": "file" } }
resources.devices.serialnumbers.powergates.uid(uid)
- uid string
var resource = client.resources.devices.serialnumbers.powergates.uid(uid);
GET
Returns information about serial number by the given uid
resource.get().then(function (res) { ... });
DELETE
Deletes serial number by the given uid
resource.delete().then(function (res) { ... });
resources.devices.serialnumbers.thirdPartyBeacons
Module for working with serial numbers for Third-Party Beacons
var resource = client.resources.devices.serialnumbers.thirdPartyBeacons;
GET
Returns list of all serial numbers for Third-Party Beacons
resource.get().then(function (res) { ... });
POST
Imports a batch of serial numbers for Third-Party Beacons
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"mac",
"uuid",
"value",
"standalone",
"model"
],
"properties": {
"value": {
"type": "string",
"description": "Value of the serial number"
},
"mac": {
"type": "string",
"description": "Mac address of the PowerBeacon device"
},
"uuid": {
"type": "string",
"description": "UUID of the PowerMote"
},
"standalone": {
"type": "boolean"
},
"model": {
"type": "string",
"description": "Beacon model name"
},
"major": {
"type": "number",
"description": "Major version of the PowerMote"
},
"minor": {
"type": "number",
"description": "Minor version of the PowerMote"
}
}
}
}
multipart/form-data
{ "file": { "description": "The file to be uploaded in csv or json format", "required": true, "type": "file", "example": "mac,uuid,standalone,value,model,major,minor\n0c:8b:fd:7e:90:87,85a99e33-bbbe-4763-a66b-4d3a3edec09b,false,TPB01,TPB01,,\n0c:8b:fd:7e:90:88,85a99e33-bbbe-4763-a66b-4d3a3edec09b,false,0c:8b:fd:7e:90:88,Third Party Beacon,1,65535\n", "displayName": "file" } }
resources.devices.serialnumbers.thirdPartyBeacons.uid(uid)
- uid string
var resource = client.resources.devices.serialnumbers.thirdPartyBeacons.uid(uid);
GET
Returns information about serial number by the given uid
resource.get().then(function (res) { ... });
DELETE
Deletes serial number by the given uid
resource.delete().then(function (res) { ... });
resources.devices.powerbeacons
Module for working with PowerBeacons
var resource = client.resources.devices.powerbeacons;
GET
Returns list of all PowerBeacons that are available for the user.
resource.get().then(function (res) { ... });
POST
Creates new PowerBeacon in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "geojson", "parent"],
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 256
},
"geojson": {
"type": "object",
"description": "Position of the PowerBeacon in GeoJSON format",
"required": ["type", "geometry", "properties"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Feature"]
},
"geometry": {
"type": "object",
"required": ["type", "coordinates"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Point"]
},
"coordinates": {
"type": "array",
"items": {
"type": "number"
}
}
}
},
"properties": {
"type": "object"
}
}
},
"serialnumber": {
"type": "number",
"description": "UID of PowerBeacon serial number entity"
},
"data": {
"type": "boolean",
"description": "Property that tells the PowerBeacon whether it should or should not transimit data"
},
"parent": {
"type": "number",
"description": "UID of the floor, where PowerBeacon located"
},
"cells": {
"type": "array",
"items": {
"type": "number",
"description": "UIDs of cells that this PowerBeacon belongs to"
}
},
"zoneDetection": {
"type": "boolean",
"description": "Property that tells the PowerBeacon whether it should make zone detection"
},
"zoneDetectionRadius": {
"type": "number",
"description": "Zone detection radius"
}
}
}
resources.devices.powerbeacons.uid(uid)
- uid string
var resource = client.resources.devices.powerbeacons.uid(uid);
DELETE
Deletes the PowerBeacon
resource.delete().then(function (res) { ... });
PATCH
Updates the PowerBeacon
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 256
},
"geojson": {
"type": "object",
"description": "Position of the PowerBeacon in GeoJSON format",
"required": ["type", "geometry", "properties"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Feature"]
},
"geometry": {
"type": "object",
"required": ["type", "coordinates"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Point"]
},
"coordinates": {
"type": "array",
"items": {
"type": "number"
}
}
}
},
"properties": {
"type": "object"
}
}
},
"serialnumber": {
"type": "number",
"description": "UID of PowerBeacon serial number entity"
},
"data": {
"type": "boolean",
"description": "Property that tells the PowerBeacon whether it should or should not transimit data"
},
"parent": {
"type": "number",
"description": "UID of the floor, where PowerBeacon located"
},
"cells": {
"type": "array",
"items": {
"type": "number",
"description": "UIDs of cells that this PowerBeacon belongs to"
}
},
"zoneDetection": {
"type": "boolean",
"description": "Property that tells the PowerBeacon whether it should make zone detection"
},
"zoneDetectionRadius": {
"type": "number",
"description": "Zone detection radius"
}
}
}
GET
Return PowerBeacon by its uid
resource.get().then(function (res) { ... });
resources.devices.powerbeacons.uid(uid).reboot
var resource = client.resources.devices.powerbeacons.uid(uid).reboot;
POST
Reboots the PowerBeacon
resource.post().then(function (res) { ... });
resources.devices.powerbeacons.uid(uid).systeminfo
var resource = client.resources.devices.powerbeacons.uid(uid).systeminfo;
GET
Returns information about CPU, RAM and Disk usages. See additional information in JSON schema.
resource.get().then(function (res) { ... });
resources.devices.powergates
Module for working with PowerGates
var resource = client.resources.devices.powergates;
GET
Returns list of all PowerGates that are available for the user.
resource.get().then(function (res) { ... });
resources.devices.powergates.uid(uid)
- uid string
var resource = client.resources.devices.powergates.uid(uid);
GET
Return PowerGate by its uid
resource.get().then(function (res) { ... });
resources.devices.powergates.uid(uid).reboot
var resource = client.resources.devices.powergates.uid(uid).reboot;
POST
Reboots the PowerGate
resource.post().then(function (res) { ... });
resources.devices.powergates.uid(uid).systeminfo
var resource = client.resources.devices.powergates.uid(uid).systeminfo;
GET
Returns information about CPU, RAM and Disk usages. See additional information in JSON schema.
resource.get().then(function (res) { ... });
resources.devices.powermotes
Module for working with PowerMotes
var resource = client.resources.devices.powermotes;
GET
Returns list of all PowerMotes that are available for the user.
resource.get().then(function (res) { ... });
POST
Creates new PowerMote in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name", "geojson", "parent"],
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 256
},
"geojson": {
"type": "object",
"description": "Position of the PowerBeacon in GeoJSON format",
"required": ["type", "geometry", "properties"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Feature"]
},
"geometry": {
"type": "object",
"required": ["type", "coordinates"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Point"]
},
"coordinates": {
"type": "array",
"items": {
"type": "number"
}
}
}
},
"properties": {
"type": "object"
}
}
},
"serialnumber": {
"type": "number",
"description": "UID of PowerBeacon serial number entity"
},
"parent": {
"type": "number",
"description": "UID of the floor, where PowerBeacon located"
}
}
}
resources.devices.powermotes.uid(uid)
- uid string
var resource = client.resources.devices.powermotes.uid(uid);
DELETE
Deletes the PowerMote
resource.delete().then(function (res) { ... });
PATCH
Updates the PowerMote
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"pattern": "^[A-Za-z0-9_\\-&\\*\\(\\)]+",
"type": "string",
"minLength": 1,
"maxLength": 256
},
"geojson": {
"type": "object",
"description": "Position of the PowerBeacon in GeoJSON format",
"required": ["type", "geometry", "properties"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Feature"]
},
"geometry": {
"type": "object",
"required": ["type", "coordinates"],
"additionalProperties": false,
"properties": {
"type": {
"enum": ["Point"]
},
"coordinates": {
"type": "array",
"items": {
"type": "number"
}
}
}
},
"properties": {
"type": "object"
}
}
},
"serialnumber": {
"type": "number",
"description": "UID of PowerBeacon serial number entity"
},
"data": {
"type": "boolean",
"description": "Property that tells the PowerBeacon whether it should or should not transimit data"
},
"parent": {
"type": "number",
"description": "UID of the floor, where PowerBeacon located"
},
"cells": {
"type":"array",
"items":{
"type":"number",
"description":"UIDs of cells that this PowerBeacon belongs to"
}
}
}
}
GET
Return PowerMote by its uid
resource.get().then(function (res) { ... });
resources.devices.statuses.recordId(recordId)
- recordId string
var resource = client.resources.devices.statuses.recordId(recordId);
GET
Statuses of devices. This service implemented via long polling mechanism.
Use recordId equal to "last" to get current information about statuses. For all subsequent calls use recordId that is returned in the "next" field of the body's response. See additional details in schema.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- returnState boolean
A boolean parameter that defines whether current state of all devices should be returned in the response.
resources.devices.connections.recordId(recordId)
- recordId string
var resource = client.resources.devices.connections.recordId(recordId);
GET
Connections of devices. This service implemented via long polling mechanism.
Use recordId equal to "last" to get current information about connections. For all subsequent calls use recordId that is returned in the "next" field of the body's response. See additional details in schema.
resource.get().then(function (res) { ... });
Query Parameters
resource.get({ ... });
- returnState boolean
A boolean parameter that defines whether current state of all devices should be returned in the response.
resources.groups.powermotes
Module for working with Groups of Powermotes in the system
var resource = client.resources.groups.powermotes;
GET
resource.get().then(function (res) { ... });
POST
Creates new Group in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
resources.groups.powermotes.uid(uid)
- uid string
var resource = client.resources.groups.powermotes.uid(uid);
DELETE
Deletes the Group
resource.delete().then(function (res) { ... });
PATCH
Updates the Group
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
GET
Returns the Group by its uid
resource.get().then(function (res) { ... });
resources.groups.trackables
Module for working with Groups of Trackable Assets and Persons in the system
var resource = client.resources.groups.trackables;
GET
resource.get().then(function (res) { ... });
POST
Creates new Group in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
resources.groups.trackables.uid(uid)
- uid string
var resource = client.resources.groups.trackables.uid(uid);
DELETE
Deletes the Group
resource.delete().then(function (res) { ... });
PATCH
Updates the Group
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
GET
Returns the Group by its uid
resource.get().then(function (res) { ... });
resources.groups.locations
Module for working with Groups of Zones and Passages in the system
var resource = client.resources.groups.locations;
GET
resource.get().then(function (res) { ... });
POST
Creates new Group in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
resources.groups.locations.uid(uid)
- uid string
var resource = client.resources.groups.locations.uid(uid);
DELETE
Deletes the Group
resource.delete().then(function (res) { ... });
PATCH
Updates the Group
resource.patch().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"children": {
"type": "array",
"items": {
"type": "number",
"description": "An uid of the object that is connected with the group"
}
}
}
}
GET
Returns the Group by its uid
resource.get().then(function (res) { ... });
resources.locations.zones
Module for working with Zones
var resource = client.resources.locations.zones;
GET
Returns list of all zones that are available for the user.
resource.get().then(function (res) { ... });
POST
Creates new zone in the system
resource.post().then(function (res) { ... });
Body
application/json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type":"object",
"additionalProperties":false,
"required":["geojson","name","access","parent"],
"properties":{
5 years ago