This section details the API endpoints for generating generic metrics within the data structure.
As a reminder, this generation relies on metric templates that must have been previously defined on the types in your data structure. If you're not familiar with this feature, please consult the documentation on metric templates.
Retrieve the list of metrics to be generated
Description
This request allows you to list all the metrics that can be generated from a template.
Note: This is not about actually generating metrics, but rather about visualizing which metrics a template can generate.
GET /v2/data-structures/{data_structure_id}/templates/generate/metrics
Scope
To perform 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
.metric_template_id (string, optional) : 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.Note : This parameter can be left empty to allow you to generate all metrics originating from templates in the data structure.
These parameters must be added to the URL to construct the query string :
/v2/data-structures/{data_structure_id}/templates/generate/metrics?metric_template_id="string"
Example Request
# Command to list metrics to be generated from a template
curl -X 'GET' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/templates/generate/metrics?metric_template_id=80ac9889-dc78-4ecc-9680-3f9ea79697a2' \
# ----- Headers -----
-H 'accept: application/json' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'
Responses
example of a valid response (200 Ok) :
Note : This response is incomplete and only shows the generation of a single metric.
{
"data": [
{
"id": "18f86cfb-7cfb-4184-8aee-11612bf7b8dc",
"dataStructureId": "67337415-6bcb-4c21-b0f5-8253d68b6e80",
"typeId": "0b3f2349-9b17-45d9-b7c4-0b47d0f39960",
"parentId": "_siteb",
"label": "ID_MOY",
"metric": {
"id": "main@cip_int_106",
"name": "cip_int_106",
"datasource": "main",
"type": "Raw"
},
"properties": {},
"parents": {
"e9910c2b-83e9-4954-a1dd-abca2d833999": [
{
"code_site": 106,
"id": "_siteb",
"label": "Site b",
"parentid": null
}
]
},
"options": {
"indabaId": "main@cip_int_106",
"indabaLabel": "Custom"
},
"isTypeMetric": true,
"hasError": false,
"metricTemplateId": "80ac9889-dc78-4ecc-9680-3f9ea79697a2",
"metricTemplateVersion": 1,
"hasTemplateCreated": false,
"isLockedToTemplate": true
}
],
"paginationInfo": {
"count": 1,
"total": 1,
"isComplete": true
},
"resultCode": 2010,
"message": "OK"
}
Common errors
Please refer to the list of common errors.
Generate Generic Metrics
Description
This request allows you to generate metrics from a template.
Note : This is not about visualizing metrics that can be generated; this endpoint is for the actual generation of metrics.
POST /v2/data-structures/{data_structure_id}/templates/generate/metrics
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
.metric_template_id (string, optional) : 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.Note : This parameter can be left empty to allow you to generate all metrics originating from templates in the data structure.
These parameters must be added to the URL to construct the query string :
/v2/data-structures/{data_structure_id}/templates/generate/metrics?metric_template_id="string"
Request example
# Command to generate metrics from a metric template
curl -X 'POST' \
'https://xxx.indaba.api.indasuite.io-base.com/v2/data-structures/67337415-6bcb-4c21-b0f5-8253d68b6e80/templates/generate/metrics?metric_template_id=80ac9889-dc78-4ecc-9680-3f9ea79697a2' \
# ----- 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 common 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.