Skip to main content

Core Concepts

SDK objects map one-to-one with IDMP product concepts. Understanding this mapping helps you locate the right API quickly.

Object Mapping

SDK Class / ModuleIDMP ConceptDescription
ApiClientSDK entry point; manages connection, auth, and request dispatch
ElementResourceApiElement (元素)A node in the asset tree — device, system, zone, etc.
AttributeResourceApiAttribute (属性)A named property of an element; can hold time-series or static values
MetricResourceApiMetric (指标)A time-series data stream derived from an attribute
EventResourceApiEvent (事件)An alert or state-change record triggered by a rule
PanelResourceApiPanel (面板)A visualization chart attached to an element
UserResourceApiUser (用户)User management and authentication
UomResourceApiUOM (计量单位)Unit of measure classes and conversions

Data Access Pattern

IDMP data follows this hierarchy:

Element
└─ Attribute
└─ Time-series data (Metric)

Typical read flow:

  1. Use ElementResourceApi to find the target element (by name, path, or ID)
  2. Use the element ID to query its attributes (AttributeResourceApi)
  3. Use the attribute ID to query time-series data (MetricResourceApi)

Pagination

All list-returning APIs are paginated. The response shape is:

{
"data": [...],
"total": 100,
"pageNum": 1,
"pageSize": 20
}

Control pagination with pageNum and pageSize query parameters:

result = element_api.api_v1_elements_get(page_num=1, page_size=50)

Response Envelope

All API responses follow a consistent envelope:

{
"code": 0,
"message": "success",
"data": { ... }
}

When code is non-zero, the SDK raises ApiException. See Error Handling.

Timestamps

All timestamp parameters and return values use Unix milliseconds (UTC):

import time
now_ms = int(time.time() * 1000)
one_hour_ago_ms = now_ms - 3600 * 1000