Rename a label value
const url = 'http://localhost:3000/api/v1/groups/labels/site/values/Plant-A';const options = { method: 'PATCH', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"newValue":"Plant-1"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:3000/api/v1/groups/labels/site/values/Plant-A \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "newValue": "Plant-1" }'Renames one value of a label key (for example site=Plant-A to site=Plant-1) on every device of the organization in one transaction, rewriting the deployment selectors and alert rules that select it. Renaming onto a value already in use fails with 409.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
Plant-AThe value to rename
Example
siteThe label key
Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The new value for the label key. Must not already be carried under that key by any device of the organization, nor selected by any deployment selector or alert rule (409 otherwise).
Example
Plant-1Responses
Section titled “Responses”Label value renamed
object
The label key that was renamed, or whose value was renamed
Key rename only: the new label key
Value rename only: the old value
Value rename only: the new value
Number of devices whose labels were rewritten
Deployments whose device selector referenced the renamed label and was rewritten to keep targeting the same devices
Alert rules whose label target referenced the renamed label and was rewritten to keep matching the same devices
Example
{ "newKey": "site", "value": "Plant-A", "newValue": "Plant-1", "affectedDevices": 42}Invalid key, value or new value
Unauthorized
Forbidden — caller lacks required permission
No device in the organization carries the label
The new value is already in use