Updated on 2022-02-24 GMT+08:00

Querying Service Capabilities of a Device

Typical Scenario

If an NA needs to know which service attributes can be reported by a device and which commands can be delivered to the device, the NA can call this API to query the device service capabilities defined in the profile file of the device on the IoT platform.

API Function

This API is used by an NA to query device service capabilities, such as service attributes and device commands.

API Description

1
public function queryDeviceCapabilities($qdcInDTO, $accessToken)

Parameter Description

Parameter

Mandatory or Optional

Location

Description

$qdcInDTO

Mandatory

query

For details, see QueryDeviceCapabilitiesInDTO structure.

$accessToken

Mandatory

header

This parameter is set to the value of the access token obtained by calling the Authentication API.

QueryDeviceCapabilitiesInDTO

Parameter

Mandatory or Optional

Location

Description

$gatewayId

Optional

query

Identifies a gateway.

$appId

Mandatory

query

If the device belongs to the current application, set this parameter to null. Otherwise, set this parameter to the ID of the authorized application.

$deviceId

Optional

query

Identifies a device.

Response Parameters

QueryDeviceCapabilitiesOutDTO

Parameter

Description

$deviceCapabilities

Indicates the query result list. For details, see DeviceCapabilityDTO structure.

DeviceCapabilityDTO structure

Parameter

Description

$deviceId

Identifies a device.

$serviceCapabilities

Indicates the service capability list. For details, see ServiceCapabilityDTO structure.

ServiceCapabilityDTO structure

Parameter

Description

$serviceId

Identifies a service.

$serviceType

Indicates the service type.

$option

Indicates a service option.

$description

Indicates the service description.

$commands

Indicates the supported commands. For details, see ServiceCommand structure.

$properties

Indicates the attribute list. For details, see ServiceProperty structure.

ServiceCommand structure

Parameter

Description

$commandName

Indicates the command name.

$paras

Indicates the attribute list. For details, see ServiceCommandPara structure.

$responses

Indicates the response list. For details, see ServiceCommandResponse structure.

ServiceCommandPara structure

Parameter

Description

$paraName

Indicates the parameter name.

$dataType

Indicates the data type.

$required

Indicates whether the parameter is mandatory.

$min

Indicates the minimum value of the attribute.

$max

Indicates the maximum value of the attribute.

$step

Indicates the step.

$maxLength

Indicates the maximum length.

$unit

Indicates the unit (symbol).

$enumList

Indicates the enumeration type list.

ServiceCommandResponse structure

Parameter

Description

$responseName

Indicates the response name.

$paras

Indicates the attribute list. For details, see ServiceCommandPara structure.

ServiceProperty structure

Parameter

Description

$propertyName

Indicates the attribute name.

$dataType

Indicates the data type.

$required

Indicates whether the parameter is mandatory.

$min

Indicates the minimum value of the attribute.

$max

Indicates the maximum value of the attribute.

$step

Indicates the step.

$maxLength

Indicates the maximum length.

$method

Indicates the access method. The values are as follows:

  • R: Readable
  • W: Writable
  • E: Observable

$unit

Indicates the unit (symbol).

$enumList

Indicates the enumeration type list.

Error Codes

HTTP Status Code

Error Code

Error Description

Remarks

400

100022

The input is invalid.

An input parameter is invalid.

Recommended handling: Check whether parameters carried in the API call request are valid.

403

100203

The application is not existed.

The application does not exist.

Recommended handling:

  • Check whether appId carried in the HTTP request header is correct.
  • Check whether appId in the request path (URL) is correct.

403

100217

The application hasn't been authorized.

The application has not been authorized.

Recommended handling: In scenarios where applications are not authorized, ensure that request parameter appId is null.

403

1010009

app throttle exceed.

The NA calls the API at a frequency that exceeds the flow control threshold (100 calls per minute by default).

Recommended handling: Contact IoT platform maintenance personnel to adjust the flow control threshold or control the API call frequency.

403

1010005

App_key or access_token is invalid.

The access token is invalid.

Recommended handling: Check whether accessToken carried in the API request is correct.

500

100203

The application is not existed.

The application does not exist.

Recommended handling:

  • Check whether appId carried in the HTTP request header is correct.
  • Check whether appId in the request path (URL) is correct.

500

50252

Internal server error.

An internal server error occurs.

Recommended handling: An internal error occurs on the IoT platform. Contact IoT platform maintenance personnel.