Get started
  • English
  • 简体中文
Official Site
Get started
  • English
  • 简体中文
Official Site
  • Get started
    • Quick start
      • Learning paths
      • Console first live view
      • First API call
      • Light-app first preview
      • SDK first preview
      • Create application
    • Account system
    • Docking mode
    • Resource download
  • Concepts
  • Guides
  • Device capabilities & events
  • API reference
  • SDK and tools
  • Solutions
  • Platform and support
On this page
Prepare AppId, AppSecret, and DataCenter
Build the request body and signature
Call accessToken
Call device.detail.page
Create or read a live address
Verify result.code and collect request evidence
Related

First API call

First API call

Call three interfaces from your server: administrator token, paged device detail, then a live-address API. Do not embed AppSecret or accessToken in a browser or app package.

Prepare AppId, AppSecret, and DataCenter

  1. Copy AppId and AppSecret from Create an app.
  2. Read the data-center id in Console · My information.
  3. Host: https://openapi-[DataCenter].easy4ip.com. Replace [DataCenter] with that id.

Build the request body and signature

Every call uses the same JSON request body: id, system, and params. system fields are in Development specification:

FieldRule from the specification
system.verCurrently 1.0
system.appIdYour AppId
system.timeUTC unix time in seconds; skew must stay within 5 minutes
system.nonce32-bit random value; reuse within 5 minutes returns SN1005
system.signSee the next paragraph
idUnique non-empty string per request

Signing source string (UTF-8, this order): time:{time},nonce:{nonce},appSecret:{appSecret}. Key: lowercase hex of SHA-256(appSecret). Then sign = Base64(HMAC-SHA256(source, key)). Full steps and samples: Development specification section 4. Compute sign per request; do not copy a sample value.

Call accessToken

POST https://openapi-[DataCenter].easy4ip.com/openapi/accessToken

params may be an empty map. Method page: accessToken.

The administrator accessToken is valid for 3 days. Refresh when it is about to expire or the API returns TK1002. Each token has its own 3-day life; do not mint a new one on every request.

Keep the token on the server. It is not a player credential.

Call device.detail.page

POST https://openapi-[DataCenter].easy4ip.com/openapi/v2/device.detail.page

Put the administrator token in params.token. Set page ≥ 1 and pageSize between 1 and 50. Method page: Paged device detail.

Confirm the bound camera is in result.data. Sub-account calls also need openid. This method is not in device.capability.list.

Create or read a live address

Pick the player you actually use. The module index is Device live.

  • HLS: bindDeviceLive. streamId 0 is HD, 1 is SD. Treat the URL as a secret.
  • RTMP: createDeviceRtmpLive.
  • ImouPlayer: mint kitToken on the server (type 1 for live). See Light-app first preview.

Addresses expire. Query and delete stay on the same live module.

Verify result.code and collect request evidence

Success is result.code "0". Other codes: Return codes. Daily call limits: Interface call limits.

When a call fails, keep id, system.time, system.nonce, the method URL, and result.code / result.msg. Do not log appSecret or a live URL in a public ticket.

Related

  • Tokens
  • Cloud live from an AppId
Console first live view
Light-app first preview