Provision JavaScript API
Connector functions - Provision JS API guide
This API allows users to manage entity provisioning (creation and retrieval) from a connector function.
provision – Main Object
The provision global object provides properties and methods to interact with the Provisioning API.
provision – Object Properties
| Property | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
If available, current connection’s apikey | API Key for the request. |
host |
string |
Frontend’s default endpoint | Host for the Provisioning API. |
identifier |
string |
null |
Identifier of the entity to act upon. |
organization |
string |
Device`s organization | Organization to which the entity belongs. |
serviceGroup |
string |
"emptyServiceGroup" |
Service Group for the entity. |
defaultChannel |
string |
"defaultChannel" |
Channel to which the entity belongs. |
plan |
string |
null |
Provisioning plan to apply. |
extraDatastreams |
Array |
[] |
Extra data as an array of objects like {datastreamId:value} pairs. |
provision – Functions
provision.get(id)
Retrieves an existing entity from the database with specified identifier.
Kind: global function
Returns: Object - If entity is found, entity data will be returned in result. If it is not found, result field will be null. If some error happened, it will be returned in error field.
| Param | Type | Default | Description |
|---|---|---|---|
id |
string |
this.identifier |
(Optional) Entity identifier. If not defined identifier field will be used. |
Example with provision.identifier:
Example with parameter:
Example with unexepected error:
The object resp.result contains then same functions than entity object.
provision.create(fullBody)
Creates a new entity in the platform.
Kind: global function
| Param | Type | Description |
|---|---|---|
fullBody |
Object |
(Optional) Complete JSON body for the creation request. If not provided, it is generated from the object properties. |
Returns: Object - An object containing either result (201 status) or error.
Example using properties:
Previous example will create with following body:
If fullBody is provided, it will be used as the request body instead of building it from the object properties.
Example: