This section describes the API endpoints for creating, listing, modifying, and deleting metric templates within a data structure.
Note : If you are not familiar with this feature, refer to the metric templates documentation.
Retrieving metric templates from the data structure
Description
This request returns a list of the various generic metric templates present in the data structure.
GET /v2/data-structures/{data_structure_id}/templates
Scope
To make this request, you must have the metadata:read scope.
Parameters
data_structure_id (string, required): ID of the tree. This ID can be retrieved via the
GET v2/data-structures
request or from the response when creating a new tree withPOST v2/data-structures
.
This parameter must be included in the URL to form the request string :
.../data-structures/{data_structure_id}/templates
Example Request
# Command to list the generic metrics of a data structure
curl -X 'GET' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/templates' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'
Responses
example of a valid response (200 OK) :
{
"data": [
{
"id": "80ac9889-dc78-4ecc-9680-3f9ea79697a2",
"label": "ID_MOY",
"metricTemplate": "main@cip_int_{code_site}",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "Custom",
"version": 1
}
],
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of errors.
Retrieving the list of metric templates within a type
This request returns a list of the various metric templates found within a specific type in your data structure.
GET /v2/data-structures/{data_structure_id}/types/{type_id}/templates
Scope
To make this request, you must have the metadata:read scope.
Parameters
data_structure_id (string, required): ID of the tree. This ID can be retrieved via the
GET v2/data-structures
request or from the response when creating a new tree withPOST v2/data-structures
.
type_id (string, required): ID assigned to the element type.
This ID can be retrieved via the GET request /v2/data-structures/{data_structure_id}/types or following the creation of a new type with Post v2/data-structures/{data_structure_id}/types.
These parameters must be added to the URL to build the query string :
.../data-structures/{data_structure_id}/types/{type_id}/templates
Request example
# Command to list a type's metric templates
curl -X 'GET' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/types/e9910c2b-83e9-4954-a1dd-abca2d833999/templates' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'
Responses
example of a valid response (200 OK) :
{
"data": [
{
"id": "80ac9889-dc78-4ecc-9680-3f9ea79697a2",
"label": "ID_MOY",
"metricTemplate": "main@cip_int_{code_site}",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "Custom",
"version": 1
}
],
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of errors.
Creating a generic metric template
Description
This request allows you to add a new metric template to a specific type within your data structure.
POST /v2/data-structures/{data_structure_id}/types/{type_id}/templates
Scope
To perform this request, you must have the metadata:admin scope.
Parameters
data_structure_id (string, required): ID of the tree. This ID can be retrieved via the
GET v2/data-structures
request or from the response when creating a new tree withPOST v2/data-structures
.type_id (string, required): ID assigned to the element type.
This ID can be retrieved via the GET request /v2/data-structures/{data_structure_id}/types or following the creation of a new type with Post v2/data-structures/{data_structure_id}/types.
These parameters must be added to the URL to construct the query string :
/v2/data-structures/{data_structure_id}/types/{type_id}/template
Request body
{
"label": "Pression",
"metricTemplate": "{datasource}@{metricId}.{territoire.libelle_court}.{name}.val",
"metricTypeId": "b63f4f26-2103-460f-bb89-727c341ccfb6",
"options": "Name"
}
label : The label for the metric template.
metric template : This is the generic name for the formulas (calculated metrics) generated by the template.
Important: You need to specify the database where these formulas will be stored. The syntax for this is as follows:
[database]@{tree_property}.documentation
metricTypeId : This is the ID of the desired "metric" type already present in your data structure. The generated formulas (calculated metrics) will be added to the data structure with the "metric" type defined here.
options : This allows you to specify how you want the metrics generated by the template to appear in the data structure.
Label : The metrics will appear with the label of the template that you defined previously.
Custom : This allows you to customize the display name of the generated metrics in the data structure.
Name : The metrics will appear with their Indaba name.
Request example
# Command to create a new metric template
curl -X 'POST' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/types/e9910c2b-83e9-4954-a1dd-abca2d833999/templates' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT' \
-H 'Content-Type: application/json' \
# ----- Request body -----
-d '
{
"label": "Pression",
"metricTemplate": "main@{code_site}.doc",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "Name"
}
'
Responses
example of a valid response (200 OK) :
{
"data": {
"id": "90cf735d-02fd-4c75-a845-9b118b1b6130",
"label": "Pression",
"metricTemplate": "main@{code_site}.doc",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "Name",
"version": 1
},
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of errors.
Update a metric's template
Description
This request allows you to update an existing formula template for a given type within your data structure.
PUT /v2/data-structures/{data_structure_id}/types/{type_id}/templates/{template_id}
Scope
To perform this request, you must have the metadata:admin scope.
Parameters
data_structure_id (string, required): ID of the tree. This ID can be retrieved via the
GET v2/data-structures
request or from the response when creating a new tree withPOST v2/data-structures
.type_id (string, required): ID assigned to the element type.
This ID can be retrieved via the GET request /v2/data-structures/{data_structure_id}/types or following the creation of a new type with Post v2/data-structures/{data_structure_id}/types.
template_id (string, mandatory) : This is the ID assigned to the metric template you want to edit. You can retrieve this ID using the
GET v2/data-structures/{data_structure_id}/types/{type_id}/templates
request or when the template was originally created.
These parameters must be added to the URL to construct the query string :
/v2/data-structures/{data_structure_id}/types/{type_id}/templates/{template_id}
Request body
The request body is identical to that used for creating a new metric template :
{
"label": "Pression",
"metricTemplate": "{datasource}@{metricId}.{territoire.libelle_court}.{name}.val",
"metricTypeId": "b63f4f26-2103-460f-bb89-727c341ccfb6",
"options": "Name"
}
Please note : It is not possible to modify the "metricTemplate" field, which represents the generic name of the metrics generated by the template.
Request example
# Command to update a metric template
curl -X 'PUT' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/types/e9910c2b-83e9-4954-a1dd-abca2d833999/templates/90cf735d-02fd-4c75-a845-9b118b1b6130' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT' \
-H 'Content-Type: application/json' \
# ----- Request body -----
-d '
{
"label": "Pression_modif",
"metricTemplate": "main@{code_site}.doc",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "name"
}
'
Responses
example of a valid response (200 OK) :
{
"data": {
"id": "90cf735d-02fd-4c75-a845-9b118b1b6130",
"label": "Pression_modif",
"metricTemplate": "main@{code_site}.doc",
"metricTypeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"options": "Name",
"version": 1
},
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of errors.
Delete a metric template
Delete /v2/data-structures/{data_structure_id}/types/{type_id}/templates/{template_id}
Scope
To perform this request, you must have the metadata:admin scope.
Parameters
data_structure_id (string, required): ID of the tree. This ID can be retrieved via the
GET v2/data-structures
request or from the response when creating a new tree withPOST v2/data-structures
.type_id (string, required): ID assigned to the element type.
This ID can be retrieved via the GET request /v2/data-structures/{data_structure_id}/types or following the creation of a new type with Post v2/data-structures/{data_structure_id}/types.
template_id (string, mandatory) : This is the ID assigned to the metric template you want to edit. You can retrieve this ID using the
GET v2/data-structures/{data_structure_id}/types/{type_id}/templates
request or when the template was originally created.delete_metrics (boolean, optional): This field lets you specify whether you want to delete the metrics associated with the template from the data structure. It can take two values :
true
: The metrics associated with the template will be deleted from the data structure.false
(default value): The metrics associated with the template will be kept in the data structure.
These parameters must be added to the URL to construct the query string :
/v2/data-structures/{data_structure_id}/types/{type_id}/templates/{template_id}?delete_metrics=[true or false]
Request example
# Command to delete a specific metric template
curl -X 'DELETE' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/types/e9910c2b-83e9-4954-a1dd-abca2d833999/templates/90cf735d-02fd-4c75-a845-9b118b1b6130?delete_metrics=true' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'
Responses
example of a valid response (200 OK) :
{
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of errors.
Common Errors
You will primarily encounter the following HTTP error codes:
400 Bad Request: Your request is malformed. This may be due to a missing parameter, an incorrect data type, or invalid JSON. The response body will contain an
errors
array detailing the problem.
{
"errors": [
{
"error": "Type_De_L_Erreur",
"message": "Description détaillée de l'erreur spécifique."
}
],
"statusCode": 1050,
"message": "Invalid request"
}
401 Unauthorized: Your authentication token (JWT) is missing, invalid, or expired. You must obtain a new valid token.
403 Forbidden: Your authentication token is valid, but you do not have the necessary rights for this action. This can happen for two reasons:
Your token does not have the required scope (e.g., you are trying to write data without the metrics:write scope).
Your token has the correct scope, but your user (or service account) is not linked to an authorization that grants access to the requested metric.
404 Not Found: The resource you are trying to reach does not exist. This typically occurs if you are using an incorrect ID or requesting a metric that does not exist.