API documentation for the use of The IoT Provider's Niobe database services.
Get JWT Authentication token
an json object containing login credentials
| username | string Username (email) |
| password | string Password |
{- "username": "string",
- "password": "string"
}{- "data": {
- "secret": "string",
- "imageUrl": "string",
- "backupcodes": [
- "string"
]
}
}Setup 2FA for a user
an json object containing login credentials
| username | string Username (email) |
| password | string Password |
{- "username": "string",
- "password": "string"
}{- "data": {
- "userId": "string",
- "token": "string",
- "refreshToken": "string",
- "userType": "string",
- "username": "string"
}
}Get JWT Authentication token
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) |
{- "userAuthenticationToken": "string",
- "secondairySecurityToken": "string"
}{- "data": {
- "userId": "string",
- "token": "string",
- "refreshToken": "string",
- "userType": "string",
- "username": "string"
}
}Create a new user account (Database access)
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 |
{- "portalTypes": [
- "diagnostics"
], - "userType": "superuser",
- "usernameNew": "user@example.com",
- "company": "string",
- "enabled2FA": false,
- "originUrls": [
- "string"
], - "password": "stringst",
- "wantsEmail": true
}{- "data": {
- "userId": "string",
- "password": "string"
}
}Change the password of the user
A new password with userId and projectId
| userId | string UserId of the account that needs an password change (_id) |
| password | string New password |
{- "userId": "string",
- "password": "string"
}{- "data": "string"
}Change the password of the user
Checks if a user exists, if so resets the users password and send the user an email.
object |
{- "data": {
- "username": "string"
}
}{- "data": "string"
}Give user an email notification and provides a link where the user will get sent to to change their password.
Provide user email that is trying to change their password and the url to where the user will be redirected to change their password.
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' |
{- "email": "string",
- "url": "string",
- "mailSubject": "string",
- "expiresIn": "string"
}{- "message": "string"
}Validates forgot password token and updates the given password of the user that got retrieved out of the token.
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. |
{- "token": "string",
- "password": "string"
}{- "message": "string"
}Executes an aggregation pipeline on the specified collection.
Request body containing the collection ID and aggregation pipeline.
| collectionId | string The Id of the collection |
| aggregation | Array of objects Aggregation pipeline to execute |
{- "collectionId": "string",
- "aggregation": [
- { }
]
}{- "data": [
- { }
]
}Create a new collection in the account
A new collection object containg projectId and collection name
| collectionName | string The name of the new collection |
{- "collectionName": "string"
}{- "data": {
- "collectionId": "string"
}
}Deletes the records from the collection in this database
| collectionId required | string collectionId |
Deletes records
| target | string The target property that needs to be replaced |
| values | Array of strings |
{- "target": "string",
- "values": [
- "string"
]
}{- "data": "string"
}Deletes records from the collection based on the provided query.
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 |
{- "collectionId": "string",
- "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
]
}{- "data": "string"
}Get records with a query
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 |
{- "collectionId": "string",
- "sortValue": "string",
- "sortDirection": "string",
- "limit": 0,
- "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
]
}{- "data": [
- { }
]
}Get unqiue records with a query
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 |
{- "collectionId": "string",
- "sortValue": "string",
- "sortDirection": "string",
- "uniqueValue": "string",
- "query": [
- {
- "fieldName": "string",
- "value": null
}
]
}{- "data": [
- { }
]
}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 !
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 |
{- "collectionId": "string",
- "fieldName": "string",
- "lat": 0,
- "lng": 0,
- "radius": 0,
- "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
]
}{- "data": [
- { }
]
}Count records with a query
Count records
| collectionId | string The Id of the collection |
| projectId | string The projectId of the database |
Array of objects |
{- "collectionId": "string",
- "projectId": "string",
- "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
]
}{- "data": [
- { }
]
}Create a new record in the collection
A new object
| collectionId | string The Id of the collection |
| record | object The new record for the collection |
{- "collectionId": "string",
- "record": { }
}{- "data": "string"
}Create a new records in the collection
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 |
{- "collectionId": "string",
- "documentArray": { },
- "model": { },
- "target": "string"
}{- "data": "string"
}Create a new record in the collection
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 |
{- "collectionId": "string",
- "recordId": "string",
- "record": { }
}{- "data": "string"
}Updates one or mutliple records
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 |
{- "collectionId": "string",
- "queryValues": [
- "string"
], - "queryField": "string",
- "updateObject": { }
}{- "data": "string"
}Change fieldvalues of a record in the collection
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. |
{- "collectionId": "string",
- "recordId": "string",
- "record": { }
}{- "data": "string"
}Create a new index in the collection
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 |
{- "collectionId": "string",
- "index": { }
}{- "data": "string"
}Create a new function
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 |
{- "functionName": "string",
- "triggerCollectionName": "string",
- "triggerCollectionId": "string",
- "destinationCollectionName": "string",
- "destinationCollectionId": "string"
}{- "data": "string"
}Create a new function
A new object
| recordId | string The _id of the function |
| codeJS | string The nodeJS function in string |
{- "recordId": "string",
- "codeJS": "string"
}{- "data": "string"
}Create a new function
A new object
| recordId | string The _id of the function |
| version | number The version of the function to deploy |
{- "recordId": "string",
- "version": 0
}{- "data": "string"
}stop a function
Function to stop
| recordId | string The _id of the function |
{- "recordId": "string"
}{- "data": "string"
}Pause a function
Function to stop
| recordId | string The _id of the function |
{- "recordId": "string"
}{- "data": "string"
}Pause a function
Function to stop
| recordId | string The _id of the function |
{- "recordId": "string"
}{- "data": "string"
}Get function logs
Function logs
| recordId | string The _id of the function |
{- "recordId": "string"
}{- "data": "string"
}Retrieve a list of all files from the storage bucket with a query.
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 |
{- "sortValue": "string",
- "sortDirection": "string",
- "limit": 0,
- "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
]
}{- "data": [
- {
- "collectionId": "string",
- "fileName": "string",
- "fileType": "string",
- "size": 0,
- "etag": "string",
- "metaData": "string"
}
]
}Upload files to the specified storage bucket in the cloud.
| files | Array of strings <binary> [ items <binary > ] Files to be uploaded |
{- "data": [
- { }
]
}Retrieve a list of all files uploaded to the specified storage bucket.
{- "collectionId": "string",
- "fileName": "string",
- "fileType": "string",
- "size": 0,
- "etag": "string",
- "metaData": "string"
}Retrieve a specific file from the specified storage bucket using its file ID.
| fileId required | string ID of the file to retrieve |
{- "collectionId": "string",
- "fileName": "string",
- "fileType": "string",
- "size": 0,
- "etag": "string",
- "metaData": "string"
}Delete a specific file from the specified storage bucket using its file ID.
| storageId required | string ID of the storage bucket containing the file |
| fileId required | string ID of the file to delete |
{ }Retrieve the download URL for a specific file stored in the given bucket.
| fileId required | string ID of the file to get the download URL for |
| expiration required | integer Expiration time in seconds for the download URL |
{- "expiration": 3600
}{- "url": "string"
}Updates the configuration of a specific device.
Request body containing the IMEI and the new configuration.
| imei | string IMEI of the device to update. |
object (DeviceConfig) |
{- "imei": "string",
- "config": {
- "checkin_budget": 50,
- "checkin_interval": 43200,
- "definition_of_movement": 20,
- "definition_of_stop": 300,
- "moving_sensitivity": "low",
- "gps": 0,
- "subghz": false,
- "powered": false
}
}{- "message": "string"
}Retrieves the configuraton of a specific device.
| imei required | string IMEI of the device to retrieve the configuraton for |
{- "checkin_budget": 50,
- "checkin_interval": 43200,
- "definition_of_movement": 20,
- "definition_of_stop": 300,
- "moving_sensitivity": "low",
- "gps": 0,
- "subghz": false,
- "powered": false
}Allows updating an existing custom API endpoint by providing its configuration and ID in the request body.
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. |
{- "id": "string",
- "method": "GET",
- "path": "string",
- "collectionId": "string",
- "pathParams": [
- "DeviceId"
], - "query": [
- {
- "fieldName": "string",
- "value": null,
- "operator": "string"
}
], - "sortDirection": "string",
- "sortValue": "_id",
- "limit": 0,
- "authenticationEnabled": true
}{- "message": "string"
}Allows creation of a new custom API endpoint by providing its configuration.
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. |
{- "method": "GET",
- "path": "string",
- "collectionId": "string",
- "pathParams": [
- "DeviceId"
], - "query": [
- {
- "fieldName": "string",
- "value": "${pathParams[0]}",
- "operator": "string"
}
], - "sortDirection": "string",
- "sortValue": "_id",
- "limit": 0,
- "authenticationEnabled": true
}{- "message": "string"
}