Save Storage Policy

Update and save the configuration of the specified storage policy, including the data storage time and models and measurement points that are configured with it.

Request Format

POST https://{apigw-address}/tsdb-policy/v2.1/policies/{policyId}

Request Parameters (Header)

Name

Mandatory/Optional

Data Type

Description

Content-Type

Mandatory

String

Content or file type. The default value is application/json.

Request Parameters (URI)

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

policyId

Path

Mandatory

String

The storage policy ID, which can be retrieved through the EnOS Management Console > Time Series Data Management > Storage Policy page.

orgId

Query

Mandatory

String

The organization ID which the asset belongs to. How to get organization ID>>

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

retention

Optional

String

The data storage time. If the models and measurement points already have the storage time configured, this parameter is optional. All supported retention include 1M, 3M, 6M, 1y, 2y, 3y, 5y, 10y, 15y, 20y.

models

Mandatory

List<JSONObject>

The list of models and measurement points. See Model and Point Struct

Model and Point Struct

Name

Mandatory/Optional

Data Type

Description

modelId

Mandatory

String

Model ID.

points

Mandatory

List<JSONObject>

A list of measurement points in the model that need storage policy configuration and point data compression configuration. See Point Compression Configuration

Error Code

For the description of error codes, see Common Error Codes.

Sample

Request Sample

url: https://{apigw-address}/tsdb-policy/v2.1/policies/yourPolicyId

method: POST

requestBody:
{
   "models": [
      {
         "modelId": "yourModelId1",
         "points": [
            {
               "pointId": "yourPointId1",
               "sdt": {
                  "compdev": 0.22,
                  "compmax": 2200,
                  "compmin": 22
               },
               "db": {
                  "excdev": 0.11,
                  "excmax": 100,
                  "excmin": 11
               }
            },
            {
               "pointId": "yourPointId2",
               "sdt": null,
               "db": null
            },
            {
               "pointId": "yourPointId3",
               "sdt": {
                  "compdev": 0.22,
                  "compmax": 2200,
                  "compmin": 22
               },
               "db": null
            }
         ]
      },
      {
         "modelId": "yourModelId2",
         "points": [
            {
               "pointId": "yourPointId4",
               "sdt": {
                  "compdev": 0.22,
                  "compmax": 2200,
                  "compmin": 22
               },
               "db": {
                  "excdev": 0.11,
                  "excmax": 1100,
                  "excmin": 11
               }
            }
         ]
      }
   ],
   "retention": "6M"
}

Return Sample

{
  "code": 0,
  "msg": "OK",
  "data": null
}

SDK Samples


You can access the Java SDK samples for TSDB policy service on GitHub.