The IoT Provider API (1.0.0)

API documentation for the use of The IoT Provider's Niobe database services.

Authentication

Authentication calls

JWT autentication

Get JWT Authentication token

Request Body schema: application/json
required

an json object containing login credentials

username
string

Username (email)

password
string

Password

Responses

Request samples

Content type
application/json
{
  • "username": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Sets up 2FA for a user who doesn't have it yet

Setup 2FA for a user

Request Body schema: application/json
required

an json object containing login credentials

username
string

Username (email)

password
string

Password

Responses

Request samples

Content type
application/json
{
  • "username": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

JWT autentication

Get JWT Authentication token

Request Body schema: application/json
required

an json object containing login credentials

userAuthenticationToken
string

The JWT token that is returned when a token request detected a user with 2Fa enabled.

secondairySecurityToken
string

This is the token that the user entered in from their mobile device authenticator (Google authenticator)

Responses

Request samples

Content type
application/json
{
  • "userAuthenticationToken": "string",
  • "secondairySecurityToken": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

JWT token check

Check JWT authentication token

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "data": "string"
}

JWT Refresh tokens

Use JWT refresh token to get new Token set

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Users

User calls

New user

Create a new user account (Database access)

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new user object

portalTypes
required
Array of strings
Items Enum: "diagnostics" "connectivity" "iot_core" "stellar"

At least one portal type is required.

userType
string
Default: "user"
Enum: "superuser" "developer" "user" "observer" "assembly" "distributor" "reseller"

Type of user

usernameNew
required
string <email>

Username (email)

company
string or null

Company name

enabled2FA
boolean
Default: false

Whether 2FA is enabled

originUrls
Array of strings or null <url> [ items <url > ]

Allowed origin URLs

password
string or null >= 8 characters

Password must be at least 8 characters

wantsEmail
boolean
Default: true

Send email notification to the new user

Responses

Request samples

Content type
application/json
{
  • "portalTypes": [
    ],
  • "userType": "superuser",
  • "usernameNew": "user@example.com",
  • "company": "string",
  • "enabled2FA": false,
  • "originUrls": [
    ],
  • "password": "stringst",
  • "wantsEmail": true
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Password change

Change the password of the user

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new password with userId and projectId

userId
string

UserId of the account that needs an password change (_id)

password
string

New password

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Password change

Change the password of the user

Authorizations:
bearerAuth
Request Body schema: application/json
required

Checks if a user exists, if so resets the users password and send the user an email.

object

Responses

Request samples

Content type
application/json
{
  • "data": {
    }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

User forgot password

Give user an email notification and provides a link where the user will get sent to to change their password.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Provide user email that is trying to change their password and the url to where the user will be redirected to change their password.

email
string

Email/Username of the account that needs a password change.

url
string

The url that will contain the generated access token, change this url to the url of the desired forgot password page.

mailSubject
string

Subject of the mail for password change

expiresIn
string

The expiry for the token that gets generated e.g. '10m', '1h', '12h'

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "url": "string",
  • "mailSubject": "string",
  • "expiresIn": "string"
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Update user password with new password

Validates forgot password token and updates the given password of the user that got retrieved out of the token.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Provide the token received via email and the new password.

token
string

The token that is generated in the url from forgot password v2 endpoint.

password
string

The new password that gets updated on the user stored in the token.

Responses

Request samples

Content type
application/json
{
  • "token": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Delete user

Delete the user from this database

Authorizations:
bearerAuth
path Parameters
id
required
string

UserId (_id)

Responses

Response samples

Content type
application/json
{
  • "data": "string"
}

Get all user from project

Get the users with acces to this database.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Database

Database calls

Get aggregated records

Executes an aggregation pipeline on the specified collection.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Request body containing the collection ID and aggregation pipeline.

collectionId
string

The Id of the collection

aggregation
Array of objects

Aggregation pipeline to execute

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "aggregation": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

New collection

Create a new collection in the account

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new collection object containg projectId and collection name

collectionName
string

The name of the new collection

Responses

Request samples

Content type
application/json
{
  • "collectionName": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get collections

Get the collections of this database.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Delete record

Delete the record from the collection in this database

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

recordId
required
string

recordId (_id)

Responses

Response samples

Content type
application/json
{
  • "data": "string"
}

Deletes more then one record

Deletes the records from the collection in this database

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

Request Body schema: application/json
required

Deletes records

target
string

The target property that needs to be replaced

values
Array of strings

Responses

Request samples

Content type
application/json
{
  • "target": "string",
  • "values": [
    ]
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Get collections

Get the collections of this database.

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get record from collections

Get the record

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

recordId
required
string

recordId {_id}

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Delete records by query

Deletes records from the collection based on the provided query.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Request body containing the collection ID and the query to define which records to delete.

collectionId
required
string

The ID of the collection to delete from.

required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Get records

Get records with a query

Authorizations:
bearerAuth
Request Body schema: application/json
required

Get records

collectionId
string

The Id of the collection

sortValue
string

An optionalsort value.

sortDirection
string

Asc or Desc optional, but if sortValue required

limit
number

An optionalvalue of the max amount of return values

Array of objects

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "sortValue": "string",
  • "sortDirection": "string",
  • "limit": 0,
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get unqique records

Get unqiue records with a query

Authorizations:
bearerAuth
Request Body schema: application/json
required

Get unique records

collectionId
string

The Id of the collection

sortValue
string

An optionalsort value.

sortDirection
string

asc or desc optional, but if sortValue required

uniqueValue
string

The name of the field that should be unique

Array of objects

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "sortValue": "string",
  • "sortDirection": "string",
  • "uniqueValue": "string",
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get locations near coordinates.

Get locations with a query. location object to serach for needs to be geoJSON. Make sure to have an index { location: '2dsphere' } for the collection !

Authorizations:
bearerAuth
Request Body schema: application/json
required

Get locations

collectionId
string

The Id of the collection to search in

fieldName
string

The name of the field where the object of lat and lng is stored.

lat
number

Latitude of the geo query

lng
number

Longitude of the geo query

radius
number

Distance in meters to search for

Array of objects

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "fieldName": "string",
  • "lat": 0,
  • "lng": 0,
  • "radius": 0,
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Count records

Count records with a query

Authorizations:
bearerAuth
Request Body schema: application/json
required

Count records

collectionId
string

The Id of the collection

projectId
string

The projectId of the database

Array of objects

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "projectId": "string",
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

New record

Create a new record in the collection

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the collection

record
object

The new record for the collection

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "record": { }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

New records

Create a new records in the collection

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the new collection

documentArray
object

List of objects that need to be inserted

model
object

Object that needs to get inserted

target
string

Field inside of model that is varaible

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "documentArray": { },
  • "model": { },
  • "target": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Update record

Create a new record in the collection

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the collection

recordId
string

The _id of the record in the database

record
object

The record you want to update for the collection

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "recordId": "string",
  • "record": { }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Updates record

Updates one or mutliple records

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the collection

queryValues
Array of strings
queryField
string

The field the values are in.

updateObject
object

The object query that you want to updated it with

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "queryValues": [
    ],
  • "queryField": "string",
  • "updateObject": { }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Change record

Change fieldvalues of a record in the collection

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the collection

recordId
string

The _id of the record in the database

record
object

An object of the field value and fieldname you want to edit.

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "recordId": "string",
  • "record": { }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

New record

Create a new index in the collection

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

collectionId
string

The Id of the collection you want to index

index
object

The new index for the collection, example { date: 1 } or { date: -1 }. -1 desc, 1 asc

Responses

Request samples

Content type
application/json
{
  • "collectionId": "string",
  • "index": { }
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Delete record

Delete the record from the collection in this database

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

indexName
required
string

indexName via getindex

Responses

Response samples

Content type
application/json
{
  • "data": "string"
}

Get indexes

Get the indexes of this database.

Authorizations:
bearerAuth
path Parameters
collectionId
required
string

collectionId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Functions

Cloud function calls

Get functions

Get the functions.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

New function

Create a new function

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

functionName
string

The name of the function

triggerCollectionName
string

The name of the collection to trigger the function

triggerCollectionId
string

The _id of the collection to trigger the function

destinationCollectionName
string

Optional: The name of the collection to save the adjusted record

destinationCollectionId
string

Optional: The id of the collection to save the adjusted record

Responses

Request samples

Content type
application/json
{
  • "functionName": "string",
  • "triggerCollectionName": "string",
  • "triggerCollectionId": "string",
  • "destinationCollectionName": "string",
  • "destinationCollectionId": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

New function

Create a new function

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

recordId
string

The _id of the function

codeJS
string

The nodeJS function in string

Responses

Request samples

Content type
application/json
{
  • "recordId": "string",
  • "codeJS": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Get record from collections

Get the function

Authorizations:
bearerAuth
path Parameters
recordId
required
string

recordId {_id}

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get dependencies for language

Get the available dependencies based on the passed language

Authorizations:
bearerAuth
path Parameters
language
required
string

the language the function uses

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

New function

Create a new function

Authorizations:
bearerAuth
Request Body schema: application/json
required

A new object

recordId
string

The _id of the function

version
number

The version of the function to deploy

Responses

Request samples

Content type
application/json
{
  • "recordId": "string",
  • "version": 0
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Stop function

stop a function

Authorizations:
bearerAuth
Request Body schema: application/json
required

Function to stop

recordId
string

The _id of the function

Responses

Request samples

Content type
application/json
{
  • "recordId": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Pause function

Pause a function

Authorizations:
bearerAuth
Request Body schema: application/json
required

Function to stop

recordId
string

The _id of the function

Responses

Request samples

Content type
application/json
{
  • "recordId": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

resume function

Pause a function

Authorizations:
bearerAuth
Request Body schema: application/json
required

Function to stop

recordId
string

The _id of the function

Responses

Request samples

Content type
application/json
{
  • "recordId": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Get function logs

Get function logs

Authorizations:
bearerAuth
Request Body schema: application/json
required

Function logs

recordId
string

The _id of the function

Responses

Request samples

Content type
application/json
{
  • "recordId": "string"
}

Response samples

Content type
application/json
{
  • "data": "string"
}

Services

Data service calls

Get location name

Get the location name of an suggested locationId. Maximum of 50 request per hour.

Authorizations:
bearerAuth
path Parameters
companyId
required
string

companyId

locationId
required
string

locationId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get usage report of location name request of the last month

Get usage report of location name request of the last month

Authorizations:
bearerAuth
path Parameters
companyId
required
string

companyId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get usage report of location name request of the last week

Get usage report of location name request of the last week

Authorizations:
bearerAuth
path Parameters
companyId
required
string

companyId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get usage report of location name request of the last 24 hours

Get usage report of location name request of the last 24 hours

Authorizations:
bearerAuth
path Parameters
companyId
required
string

companyId

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Storage

Cloud storage calls

Get all files from the storage bucket with a query

Retrieve a list of all files from the storage bucket with a query.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Query for files

sortValue
string

An optionalsort value.

sortDirection
string

Asc or Desc optional, but if sortValue required

limit
number

An optionalvalue of the max amount of return values

Array of objects

Responses

Request samples

Content type
application/json
{
  • "sortValue": "string",
  • "sortDirection": "string",
  • "limit": 0,
  • "query": [
    ]
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Upload files to the cloud

Upload files to the specified storage bucket in the cloud.

Authorizations:
bearerAuth
Request Body schema: multipart/form-data
required
files
Array of strings <binary> [ items <binary > ]

Files to be uploaded

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get all files from the storage bucket

Retrieve a list of all files uploaded to the specified storage bucket.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "collectionId": "string",
  • "fileName": "string",
  • "fileType": "string",
  • "size": 0,
  • "etag": "string",
  • "metaData": "string"
}

Get a specific file from the storage bucket

Retrieve a specific file from the specified storage bucket using its file ID.

Authorizations:
bearerAuth
path Parameters
fileId
required
string

ID of the file to retrieve

Responses

Response samples

Content type
application/json
{
  • "collectionId": "string",
  • "fileName": "string",
  • "fileType": "string",
  • "size": 0,
  • "etag": "string",
  • "metaData": "string"
}

Delete a specific file from the storage bucket

Delete a specific file from the specified storage bucket using its file ID.

Authorizations:
bearerAuth
path Parameters
storageId
required
string

ID of the storage bucket containing the file

fileId
required
string

ID of the file to delete

Responses

Response samples

Content type
application/json
{ }

Get the download URL for a specific file

Retrieve the download URL for a specific file stored in the given bucket.

Authorizations:
bearerAuth
path Parameters
fileId
required
string

ID of the file to get the download URL for

Request Body schema: application/json
required
expiration
required
integer

Expiration time in seconds for the download URL

Responses

Request samples

Content type
application/json
{
  • "expiration": 3600
}

Response samples

Content type
application/json
{
  • "url": "string"
}

Device Config

Device configuration calls

Update Device Configuration

Updates the configuration of a specific device.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Request body containing the IMEI and the new configuration.

imei
string

IMEI of the device to update.

object (DeviceConfig)

Responses

Request samples

Content type
application/json
{
  • "imei": "string",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Get Device Configuration

Retrieves the configuraton of a specific device.

Authorizations:
bearerAuth
path Parameters
imei
required
string

IMEI of the device to retrieve the configuraton for

Responses

Response samples

Content type
application/json
{
  • "checkin_budget": 50,
  • "checkin_interval": 43200,
  • "definition_of_movement": 20,
  • "definition_of_stop": 300,
  • "moving_sensitivity": "low",
  • "gps": 0,
  • "subghz": false,
  • "powered": false
}

Builder

Create Custom API's

Update an existing custom API endpoint

Allows updating an existing custom API endpoint by providing its configuration and ID in the request body.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Configuration details and ID for updating the API endpoint.

id
string

Id of the api endpoint to update

method
required
string
Value: "GET"

HTTP method for the custom endpoint.

path
required
string [ 1 .. 255 ] characters

Path for the custom endpoint (e.g., my-custom-path).

collectionId
required
string non-empty

ID of the database collection to interact with.

pathParams
Array of strings [ 1 .. 10 ] items [ items [ 1 .. 255 ] characters ]
Default: ["DeviceId"]

Query path names that will be included in the path like /path/:{name}

Array of objects

Query parameters for the endpoint (optional).

sortDirection
string

Sort direction (asc or desc, optional).

sortValue
string
Default: "_id"

Field to sort by (optional).

limit
integer

Maximum number of records to return (optional).

authenticationEnabled
boolean
Default: true

Whether authentication is required for the endpoint.

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "method": "GET",
  • "path": "string",
  • "collectionId": "string",
  • "pathParams": [
    ],
  • "query": [
    ],
  • "sortDirection": "string",
  • "sortValue": "_id",
  • "limit": 0,
  • "authenticationEnabled": true
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Create a new custom API endpoint

Allows creation of a new custom API endpoint by providing its configuration.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Configuration details for the new API endpoint.

method
required
string
Value: "GET"

HTTP method for the custom endpoint.

path
required
string [ 1 .. 255 ] characters

Path for the custom endpoint (e.g., my-custom-path).

collectionId
required
string non-empty

ID of the database collection to interact with.

pathParams
Array of strings [ 1 .. 10 ] items [ items [ 1 .. 255 ] characters ]
Default: ["DeviceId"]

Query path names that will be included in the path like /path/:{name}

Array of objects

Query parameters for the endpoint (optional).

sortDirection
string

Sort direction (asc or desc, optional).

sortValue
string
Default: "_id"

Field to sort by (optional).

limit
integer

Maximum number of records to return (optional).

authenticationEnabled
boolean
Default: true

Whether authentication is required for the endpoint.

Responses

Request samples

Content type
application/json
{
  • "method": "GET",
  • "path": "string",
  • "collectionId": "string",
  • "pathParams": [
    ],
  • "query": [
    ],
  • "sortDirection": "string",
  • "sortValue": "_id",
  • "limit": 0,
  • "authenticationEnabled": true
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Get all custom API endpoints

Allows creation of a new custom API endpoint by providing its configuration.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

Delete custom API endpoint

Allows deletion of a custom API endpoint.

Authorizations:
bearerAuth
path Parameters
id
required
string

The unique identifier of the API endpoint record

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

Custom

Custom API calls