Get started
  • English
  • 简体中文
Official Site
Get started
  • English
  • 简体中文
Official Site
  • Get started
  • Concepts
  • Guides
  • Device capabilities & events
    • Browse by device type
    • Device capabilities
      • Common methods
        • Using capabilities
        • device.capability.list (List capabilities)
        • device.property.get (Read properties)
        • device.property.set (Write properties)
        • Invoke a service
      • Detection and alarms
      • Image
      • PTZ
      • Light
      • Recording
      • Audio
      • Media
      • Network
      • Power
      • Privacy
      • Call
      • Storage
      • System
      • Algorithm
      • Maintenance
      • Control
    • Events overview
    • Permission codes
    • Capability error codes
    • Alarm and capability messages
    • Capability FAQ
    • Legacy ability and push types
  • API reference
  • SDK and tools
  • Solutions
  • Platform and support
On this page
What it does
Request URL
Minimum permission
Request parameters
Request example
Response data fields
Response example
Error codes

Invoke a service

Invoke a service

What it does

Invokes a one-shot action. There is no persistent state—each call runs once and is not idempotent. A timeout does not mean the action did not run. Use the full serviceId. Actions use this API, not device.property.set.

For PTZ movement, use ptz.aim.relative. Input fields are documented on the PTZ pages.

Request URL

POST https://openapi-[DataCenter].easy4ip.com/openapi/v2/device.service.invoke

Minimum permission

An administrator needs no extra permission on a device they bound. A shared device needs permission for the capability that owns the action (for example, PTZ actions need PTZ permission). A bound sub-user needs none. A sub-account needs the auth code for that capability (for example, Ptz for PTZ).

Request parameters

NameTypeRequiredDefaultAllowed valuesDescription
tokenStringyesAdministrator, sub-user, or sub-account accessToken
deviceIdStringyesDevice serial number
productIdStringnoOptional. If sent and it does not match the device model → DV2009
channelIdStringconditionalChannel index; IPCs often "0". Do not pass -1Required for channel-level actions; omit for device-level
serviceIdStringyesFull serviceId, e.g. ptz.aim.relativeOne service per request
inputDataObjectconditionalfield keys from inputData in device.capability.list or on the service pageRequired when that inputData array is non-empty; use {} when there are no inputs. Speed fields are often strings, e.g. "0.5", not numbers

Common request fields and signing: Signing and Common request payload.

Request example

{
 "id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
 "system": {
 "ver": "1.0",
 "appId": "lcdxxxxxxxxx",
 "sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
 "time": 1706511734,
 "nonce": "f5a1ae2d-c09c-4d39-a744-83a5c2c653c2"
 },
 "params": {
 "token": "<yourAccessToken>",
 "deviceId": "TESTIPC000012345",
 "channelId": "0",
 "serviceId": "ptz.aim.relative",
 "inputData": {
 "horizontal": "0.5",
 "vertical": "0",
 "zoom": "0",
 "duration": 1000
 }
 }
}

Response data fields

NameTypeDescription
outputDataObjectService output. {} when there are no outputs. Field names match the catalog entry, e.g. ptz.cruise.get

Response example

No outputs (e.g. ptz.aim.relative):

{
 "id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
 "result": {
 "code": "0",
 "msg": "Operation is successful",
 "data": {
 "outputData": {}
 }
 }
}

With outputs (ptz.cruise.get, inputData {}):

{
 "id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
 "result": {
 "code": "0",
 "msg": "Operation is successful",
 "data": {
 "outputData": {
 "cruiseModel": "1",
 "collection": [
 {
 "name": "Front door",
 "stayTime": "15"
 }
 ],
 "cruises": [
 {
 "beginTime": "08:00:00",
 "endTime": "18:00:00",
 "period": "1111100"
 }
 ]
 }
 }
 }
}

Error codes

This API may return the codes below.

Gateway and device codes: Global return codes.

device.property.set (Write properties)
detection.arming.enabled (Read arming switch)