Updated on 2024-06-27 GMT+08:00

Modify a Device Proxy

Function

This API is used by an application to modify the basic information of a specific device proxy on the IoT platform.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

PUT /v5/iot/{project_id}/device-proxies/{proxy_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

proxy_id

Yes

String

Parameter description: device proxy ID, which uniquely identifies a device proxy. The value of this parameter is allocated by the IoT platform during device proxy registration.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication.

Instance-Id

No

String

Parameter description: instance ID. Unique identifier of each instance in the physical multi-tenant scenario. Mandatory for professional editions and recommended in other cases. Log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. For details, see Viewing Instance Details.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

proxy_name

No

String

Parameter description: device proxy name.

Minimum: 1

Maximum: 64

proxy_devices

No

Array of strings

Parameter description: device proxy list. All devices in the list share the gateway permission. That is, child devices under any gateway in the list can go online through any gateway in the group and report data. Value: Enter two to ten device IDs in the list. A device ID can contain up to 128 characters, including letters, digits, underscores (_), and hyphens (-). Recommended min. ID length: 4 characters.

effective_time_range

No

EffectiveTimeRange object

Parameter Description: rule validity period.

Table 4 EffectiveTimeRange

Parameter

Mandatory

Type

Description

start_time

No

String

Time when the device proxy starts to take effect. Format (UTC time): yyyyMMdd'T'HHmmss'Z'.

end_time

No

String

Time when the device proxy expires. The value must be later than the value of start_time. Format (UTC time): yyyyMMdd'T'HHmmss'Z'.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

proxy_id

String

Parameter description: device proxy ID, which uniquely identifies a proxy rule.

proxy_name

String

Parameter description: device proxy name.

proxy_devices

Array of strings

Parameter description: device proxy group. All devices in the group share the gateway permission. That is, child devices under any gateway in the group can go online through any gateway in the group and report data.

effective_time_range

EffectiveTimeRangeResponseDTO object

Parameter Description: validity period of a device proxy rule.

app_id

String

Parameter description: resource space ID.

Table 6 EffectiveTimeRangeResponseDTO

Parameter

Type

Description

start_time

String

Time when the device proxy starts to take effect. Format (UTC time): yyyyMMdd'T'HHmmss'Z'.

end_time

String

Time when the device proxy expires. The value must be later than the value of start_time. Format (UTC time): yyyyMMdd'T'HHmmss'Z'.

Example Requests

Modifies a device proxy.

PUT https://{endpoint}/v5/iot/{project_id}/device-proxies/{proxy_id}

{
  "proxy_name" : "jeQDJQZltU8iKgFFoW060F5SGZka",
  "proxy_devices" : [ "d4922d8a-6c8e-4396-852c-164aefa6638f", "d4922d8a-6c8e-4396-852c-164aefa6638g" ],
  "effective_time_range" : {
    "start_time" : "20200812T121212Z",
    "end_time" : "20200812T121212Z"
  }
}

Example Responses

Status code: 200

OK

{
  "proxy_id" : "04ed32dc1b0025b52fe3c01a27c2babc",
  "proxy_name" : "testAPP01",
  "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka",
  "proxy_devices" : [ "d4922d8a-6c8e-4396-852c-164aefa6638f", "d4922d8a-6c8e-4396-852c-164aefa6638g" ],
  "effective_time_range" : {
    "start_time" : "20200812T121212Z",
    "end_time" : "20210812T121212Z"
  }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.