Labels Reference
This topic provides properties, parameters, and examples for labels.
Query parameters for labels
Parameter | Description | Type | Required |
|---|---|---|---|
| Organization ID | Integer | Yes |
| A unique identifier within the external data source | String | No |
| The data source from which a resource originates | String | No |
| Include deleted labels | Boolean | No |
| Key by which to filter | String | GET: No POST: Yes |
| Maximum number of labels to return. | Integer | No |
| Indicate label usage, including if the label is currently used in an RBAC scope for user permissions if the label is applied to a workload, virtual service, Pairing Profile, selective enforcement, virtual server, or ruleset, and if the label belongs to a label group. | Boolean | No |
| Value on which to filter. Supports partial matches. | String | GET, PUT: No POST: Yes |
| Label ID, for | Integer | Yes |
Properties for labels
Property | Description | Type |
|---|---|---|
| Key in key-value pair | String |
| Value in key-value pair", | String |
| Label URI | |
| Timestamp when this label was last updated | String |
| Timestamp when this label was first created | String |
| A unique identifier within the external data source | String, Null |
| The data source from which a resource originates | String, Null |
Curl Command to Get Collection of Labels
curl -i -X GET https://pce.my-company.com:8443/api/v2/orgs/2/labels -H "Accept: application/json" -u $KEY:$TOKEN
Response Body
In the response body, each label returned is identified as an HREF, for example: "/orgs/2/labels/1662"
For example:
{
href: "/orgs/2/labels/1662"
key: "env"
value: "Prod"
created_at: "2020-01-22T18:24:33Z"
updated_at: "2020-01-22T18:24:40Z"
created_by: {
href: "/users/9"
}
updated_by: {
href: "/users/9"
}
}
{
href: "/orgs/2/labels/1128"
key: "role"
value: "DB"
created_at: "2020-01-22T18:24:53Z"
updated_at: "2020-01-22T18:24:59Z"
created_by: {
href: "/users/9"
}
updated_by: {
href: "/users/9"
}
}
Curl Command to Get a Label
curl -i -X GET https://pce.my-company.com:8443/api/v2/orgs/2/labels/8 -H "Accept: application/json" -u $KEY:$TOKEN
Response Body
{
href: "/orgs/2/labels/8"
key: "env"
value: "Prod"
created_at: "2020-01-22T18:24:33Z"
updated_at: "2020-01-22T18:24:40Z"
created_by: {
href: "/users/9"
}
updated_by: {
href: "/users/9"
}
}An example request body to create a label
{
"key":"role",
"value":"web"
}Curl Command to Create a Label
curl -i -X POST https://pce.my-company.com:8443/api/v2/orgs/2/labels -H "Content-Type: application/json" -u $KEY:$TOKEN -d '{"key":"role","value":"web"}' Response Body
The created label is in the form of an HREF path property. For example, in the response below, the label is identified as "/orgs/2/labels/1677".
{
href: "/orgs/2/labels/1677"
key: "role"
value: "my_web_app"
created_at: "2014-04-18T19:39:27Z"
updated_at: "2014-04-18T19:39:27Z"
created_by: {
href: "/users/76"
}
updated_by: {
href: "/users/76"
}
}An example request body to update a label
To update a label definition, the JSON request body can be constructed as follows:
{ "value":"db" }Curl Command to Update a Label
curl -X PUT https://pce.my-company.com:8443/api/v2/orgs/2/labels/1662 -H "Accept: application/json" -u $KEY:$TOKEN -d '{"value":"db"} Curl Command to Delete a Label
curl -i -X DELETE https://pce.my-company.com:8443/api/v2/orgs/2/labels/1662 -H "Accept: application/json" -u $KEY:$TOKEN