Skip to main content

Storage Rule Management (/v2/storage-rules)

Updated over a week ago

This section details the endpoints for creating, listing, modifying, and deleting storage rules. These rules define how data is filtered and saved to optimize the database.


List storage rules

Description

This request retrieves the list of all available storage rules.

GET /v2/storage-rules

Scope

To execute this request, you must have the following scope: metrics:read.

Parameters

  • paginationKey (string, optional): Key to get the next page of results (see pagination handling).

  • limit (integer, optional): Number of results per page (default: 50).

These parameters must be added to the end of the URL to build the query string. The first is preceded by a "?" and the following ones are separated by an "&":

General syntax of the GET request: .../storage-rules?limit=[limit]&paginationKey=[pagination_key]

Example request

# Command to list all storage rules
curl -X GET \
'https://xxx.indaba.api.indasuite.io-base.com/v2/storage-rules' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'

Responses

Example of a valid response (200 OK):

{ 
"data": [
{
"id": "e232594c-b40a-4e0b-8d18-57317a9a06cd",
"name": "storage rule 1",
"deadband": 0.01,
"validityInSecond": 0,
"decimalPrecision": 3,
"isDefault": false
},
{
"id": "8059a704-9bae-47e2-a1ae-99790853a66a",
"name": "storage rule 2",
"deadband": 0.003,
"validityInSecond": 300,
"decimalPrecision": 4,
"isDefault": false
}
],
"paginationInfo": {
"count": 2,
"isComplete": true
},
"statusCode": 1010,
"message": "OK"
}

Pagination Handling (isComplete)

Please refer to the section on pagination handling.

Common Errors

Please refer to the list of common errors.


Create a new storage rule

Description

This request allows you to create a new storage rule to define the conditions for saving data.

POST /v2/storage-rules

Scope

To execute this request, you must have the following scope: metrics:admin.

Request Body

  • name (string, required): Unique name for the storage rule.

  • validityInSecond (integer, optional): Duration of validity in seconds. If a value does not change (or remains within the deadband) during this period, it will not be re-recorded.

  • deadband (number, optional): Deadband. If the difference between a new value and the previous one is less than this delta, the new value is not recorded.

  • decimalPrecision (integer, optional): Number of decimal places to keep for the values.

The following fields must be provided in the request body, in JSON format.

General syntax of the request body:

{ 
"name": "nom_unique_de_la_regle",
"validityInSecond": 3600,
"deadband": 0.5,
"decimalPrecision": 2
}

Example request

# Command to create a new storage rule with all fields 
curl -X POST \
--url 'https://xxx.indaba.api.indasuite.io-base.com/v2/storage-rules' \

# ----- Headers -----
-H 'Authorization: Bearer VOTRE_JETON_JWT' \
-H 'Content-Type: application/json' \

# ----- Body -----
-d '
{
"name": "storage rule api test_2",
"validityInSecond": 3600,
"deadband": 0,
"decimalPrecision": 1
}
'

Responses

Example of a valid response (200 OK):

{ 
"data": {
"id": "adacb6b9-0178-4cd2-a11e-40d121cae56e",
"name": "storage rule api test_2",
"deadband": 0,
"validityInSecond": 3600,
"decimalPrecision": 1,
"isDefault": false
},
"resultCode": 1010,
"message": "OK"
}

Pagination Handling (isComplete)

Please refer to the section on pagination handling.

Common Errors

Please refer to the list of common errors.


Update a storage rule

Description

This request allows you to modify an existing storage rule.

PUT /v2/storage-rules/{storageRuleId}

Scope

To execute this request, you must have the following scope: metrics:admin.

Parameters

  • storageRuleId (uuid, required): ID of the storage rule to modify.

This request uses a path parameter, which is integrated directly into the URL.

General URL syntax: .../storage-rules/[storage_rule_uuid]

Request Body

The following fields must be provided in the request body, in JSON format. They are identical to those for creating a storage rule.

General syntax of the request body:

{ 
"name": "nouveau_nom_de_la_regle",
"validityInSecond": 3600,
"deadband": 0,
"decimalPrecision": 1
}

Request example

# command to update a storage rule
curl -X PUT \
--url 'https://xxx.indaba.api.indasuite.io-base.com/v2/storage-rules/ae915375-048f-41bc-807c-69b451b85975' \

# ----- Headers -----
-H 'Authorization: Bearer VOTRE_JETON_JWT' \
-H 'Content-Type: application/json' \

# ----- Body -----
-d '
{
"name": "TestRule_Updated_Complete",
"validityInSecond": 600,
"deadband": 0,
"decimalPrecision": 2
}
'

Responses

Example of a valid response (200 OK):

{ 
"statusCode": 1010,
"message": "OK"
}

Common Errors

Please refer to the list of common errors.


Delete a storage rule

Description

This request deletes a storage rule.

Warning: metrics that were using this rule will fall back to the default storage rule.

DELETE /v2/storage-rules/{storageRuleId}

Scope

To execute this request, you must have the following scope: metrics:admin.

Parameters

  • storageRuleId (uuid, required): ID of the storage rule to delete.

This request uses a path parameter, which is integrated directly into the URL.

General syntax of the DELETE request: .../storage-rules/[storage_rule_uuid]

Example request

# Command to delete a storage rule
curl -X DELETE \
'https://xxx.indaba.api.indasuite.io-base.com/v2/storage-rules/ae915375-048f-41bc-807c-69b451b85975' \
-H 'Authorization: Bearer VOTRE_JETON_JWT'

Responses

Example of a valid response (200 OK):

{ 
"statusCode": 1010,
"message": "OK"
}

Common Errors

Please refer to the list of common errors.


Pagination handling

For performance reasons, when requesting a large number of results (for example, a long list of metrics), the API may divide the response into several "pages". This pagination is managed via the paginationInfo object found in some responses.

  • If isComplete is true: You have received all the data.

  • If isComplete is false: There is more data to retrieve. To get the next page :

    1. Retrieve the value of the paginationKey field from the response you just received.

    2. Make a new request, adding the paginationKey as a parameter with the value you retrieved.

    3. Repeat this process until the final response contains isComplete: true.


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": "Field Required",
    "message": "The xxx field is required."
    }
    ],
    "statusCode": 1050,
    "message": "Invalid request"
    }
  • 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.

Did this answer your question?