About EnOS Metric Management API


EnOS Metric Management provides one-step metric standardized definition, metric configuration calculation and metric multi-source query service. For more details about Metric Management, see EnOS Metric Management.


Metric Management API provides the capability to query metric data in batches.


For more information about how to invoke EnOS APIs, see Get Started with EnOS API.

API Service List


Refer to the table below for the list of Metric Management APIs, and whether they can be used by EnOS Cloud and EnOS Edge.


Operation Name Description URL EnOS Cloud EnOS Edge
Query Metric Data Query metric data in batches /metric-mgmt/v1.0/metricIds/data/normal ×

API Editions


The following table lists the API services included in Metric Management Enterprise and Lightweight editions.


Operation Name Enterprise Lightweight
Query Metric Data

API Request


A Metric Management API request consists of the URI and Header.

Request URI


METHOD {URI-scheme}://{apigw-address}/{service-name}/{version}/{endpoint-URL}??{action=query&{}}


In the URI:

  • METHOD:HTTP Method. For example, GET and POST.
  • URI-scheme:API protocol. Use HTTPS protocol.
  • apigw-address:API gateway address. It can be retrieved by logging in to the EnOS Management Console and clicking Help > Environment Information at the top right. Refer to the address under API Gateway. For example, app-portal-xxx.envisioniot.com
  • service-name:Service name. For example, cds-metric-service.
  • version:API version. For example, v1.0.
  • endpoint-URL:Resource name or operations on resources. For example, metricIds.
  • action=query&:Query parameters in URI. Use & as delimiters if there are multiple parameters. For example, action=query&orgId={yourOrgId}&mdmIds={yourMdmId}.

Request Header



The fields required by the REST API specification or the HTTP specification are bound in the request header.


The commonly used request header is Content-Type, which represents the data submission method. In general, its value can be set to application / json; charset = UTF-8; if file upload or other form submission is performed, the value is set to multipart / form-data; charset = UTF-8.

Request Sample


url: https://{apigw-address}/metric-mgmt/v1.0/metricIds/data/normal?orgId=orgId&metricIds=metricId0,metricId1&startTime=2021-05-19 00:00:00&endTime=2021-05-21 00:00:00

method: GET

API Response


The JSON structure of a Metric Management API response is as below.


{
    "msg": "OK",
    "code": 0,
    "data": [{

    }]
}

Response Parameters


A Metric Management API response consists of the following parameters.


Name Data Type Description
msg String The explanation of the status codes. “OK” indicates a successful request. If the API request fails, the specific error message will be returned.
code Integer The API request status code. “0” means that the request is successful. For other status codes, see the Response Codes section.
data Array or Object The returned dataset. The data type includes basic type, complex type, or array.

Response Samples


Sample of response success.


{
  "msg": "OK",
  "code": 0,
  "data": [
        {
            "metricIdentifier":"MetricId0",
            "value":[
                {
                "storage_active_electric": 2200.00,
                "time": "2021-05-20",
                "mdmId": "mdmId0"
                },
                {
                "storage_active_electric": 100.00,
                "time": "2021-05-20",
                "mdmId": "mdmId1"
                }
            ]
        },
        {
            "metricIdentifier":"MetricId1",
            "value":[
                {
                "storage_reactive_electric": 2200.00,
                "time": "2021-05-20",
                "mdmId": "mdmId0"
                },
                {
                "storage_reactive_electric": 100.00,
                "time": "2021-05-20",
                "mdmId": "mdmId1"
                }
            ]
        }
    ]
}