The core API defines actions that can be called on the resources. The api call of a specific action is standardized which means that you access each resource in a similar way. In total, 6 types of actions are defined:
Not every action is supported on every resource (e.g. you can not delete a Dataprovider). The rest of this documentation will provide information on the call signature for each action and will then go into details with concrete examples for each combination of resource and action.
Create a new instance of the requested resource type, for example: create a new User within an Organization, create a new access group, create new data rows, …
| Parameter | Description |
|---|---|
|
resource string |
The lowercase name of the resource we want to create |
|
properties object |
Here you provide the properties of the entity you want to create in the form of a map/object |
client.create(
'<resource name>',
{
'attribute name': '<attribute value>'
},
[
{
role: '<resource to link name>',
id: '<resource entity id>'
},
{
role: '<resource to link name>',
id: '<resource entity id>'
}
]
)
.then(function(<resource name>) {
console.log('Success!', <resource name>);
});Update the properties of a single specific entity, eg. update a column name or user password.
| Parameter | Description |
|---|---|
|
resource string |
The lowercase name of the resource we want to update |
|
id uuid |
The id of the entity to update |
|
properties object |
Here you provide the properties of the entity you want to update in the form of a map/object. If a property is not present in the map, it will remain untouched |
client.update(
'<resource name>',
'<your <resource name> id>',
{
'attribute name': '<attribute value>'
}
)
.then(function(data) {
console.log('Success!', data);
});Delete a resource, eg. delete a dataset or group.
| Parameter | Description |
|---|---|
|
resource string |
The lowercase name of the resource we want to delete |
|
id uuid |
The id of the entity to delete |
const promise = client.delete('<resource name>', '<your <resource name> id>');Get and List are the same call. The reason why we differentiate between a Get and a List action is that different security rules apply. A user who can get a resource can't necessarily list the same resource. Get and List have a different structure than the other calls since it allows for complex queries. A call is considered to be a get action if you fetch an entity using a specific id in the where clause, else it is considered to be a list action. The query syntax is very close to SQL, it consists of the following attributes:
| Parameter | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
|
resource string |
The lowercase name of the resource we want to get or list | ||||||||
|
query object |
The id of the entity to delete | ||||||||
|
|||||||||
client.get(
'<resource name>',
{
where: {
'attribute name': '<attribute value>'
},
include: [
{
model: '<resource name>'
}
],
attributes: [
'<attribute name>',
'<attribute name>'
],
order: [
[
'<attribute name>',
'asc'
],
[
{
model: '<resource name>'
},
'<attribute name>',
'asc'
]
]
}
)
.then(function(data) {
console.log('Success!', data);
});Associate two entities to each other, eg. link a Column to a Dataset. Associations can be set in both directions. Many associations are automatically set on creation as well, for example a dashboard is automatically associated with the user that created the dashboard. To know which resources can be associated please refer to the schema at the beginning of this chapter Schema .
| Parameter | Description | ||||
|---|---|---|---|---|---|
|
id uuid |
The uuid of the resource you want to associate with another resource | ||||
|
resource object |
An object indicating which resource type (role) and which entity (id) | ||||
|
|||||
|
properties object |
some associations can have property set on them. e.g. on a User - Dataset relationship, there is a flagOwner property | ||||
const promise = client.associate(
'<resource name>',
'<your <resource name> id>',
{
role: '<resource to link name>',
id: '<resource entity id>'
},
{
'property name': '<property value>'
}
);Notice that associate roles are usually capitalized and plural.
Remove an association between 2 entities. To know which resources can be disassociated please refer to the schema at the beginning of this chapter Schema .
| Parameter | Description | ||||
|---|---|---|---|---|---|
|
id uuid |
The uuid of the resource you want to dissociate with another resource | ||||
|
resource object |
An object indicating which resource type (role) and which entity (id) | ||||
|
|||||
const promise = client.dissociate(
'<resource name>',
'<your <resource name> id>',
{
role: '<resource to link name>',
id: '<resource entity id>'
}
);