: Add User-defined Tags
Focus
Focus

Add User-defined Tags

Table of Contents

Add User-defined Tags

Use the IoT Security API to add a custom user-defined tag to one or more IoT devices.

Synopsis

URI/pub/v4.0/device/update
HTTP MethodPUT
FQDN<customer-name>.iot.paloaltonetworks.com

Description

Add a user-defined tag to one or more IoT devices.

Request Fields

The URL of this request contains the following parameters:
FieldDescription
customerid
(Required) The customer ID specifies the API call for a specific tenant.
The following value is a string.
The payload of this request contains the following parameters:
FieldDescription
tag
A user-defined tag being assigned to one or more devices. The tag can be a string or object, cannot contain special characters, and can contain one or two attributes: tagType (optional) and tagValue.
If you enter both components of a key-value pair, then you must use the keyword for each field. Example:
“tag”: {“tagType”: “custom tag type1”, “tagValue”: “custom tag value1”}
If you omit the key, then enter just the value without a keyword for its field. Example:
“tag”: “custom tag value1”
tagTypeThe key for a user-defined tag
tagValueThe value of the key for a user-defined tag
deviceidlist
(Required) An array of one or more device IDs to which you are applying the user-defined tag. Each item in the array is a string.
Request to Add a User-defined Tag as a Key-Value Pair Example
curl --location -X PUT 'https://acmecorp.iot.paloaltonetworks.com/pub/v4.0/device/update?customerid=acmecorp' \ -H 'X-Key-Id: KEY_ID' \ -H 'X-Access-Key: ACCESS_KEY' \ --header 'Content-Type: application/json' \ --data-raw \ '{ "tag": { "tagType": "Peninsula-Pacific", "tagValue": "F4" }, "deviceidlist": [ "00:e0:81:e6:01:4b", "00:e0:81:e6:02:55", "0c:c4:7a:a8:c3:22" ] }'
Request to Add a User-defined Tag as a Value Example
curl --location -X PUT 'https://acmecorp.iot.paloaltonetworks.com/pub/v4.0/device/update?customerid=acmecorp' \ -H 'X-Key-Id: KEY_ID' \ -H 'X-Access-Key: ACCESS_KEY' \ --header 'Content-Type: application/json' \ --data-raw \ '{ "tag": "F4" "deviceidlist": [ "00:e0:81:e6:01:4b", "00:e0:81:e6:02:55", "0c:c4:7a:a8:c3:22" ] }'

Success Response

Upon success, the HTTP response code is 200.
Success Response Example
{ "api": "/pub/v4.0/device/update", "ver":"v4.0", "code": 1, "message": "OK", "updatedDeviceNum": 3 }

Error Response

Upon error, the reply includes an HTTP response code, an error message, and additional information describing the error. The HTTP response code is one of the following:
FieldDescription
400Bad Request. This occurs when an HTTP request contains invalid JSON in its body.
403Forbidden access. Either the provided API Key is invalid or it does not have the required RBAC permissions to run this API.
429Too many requests. The number of requests to add a user-defined tag exceeded the rate limit of 180 queries per minute per tenant.
500Internal server error. A unified status for API communication type errors.
Error Response Format
{code: STATUS_CODE, msg: GENERAL_MESSAGE}