Labels
List labels
Example Request:
curl "https://controller-host:8001/api/v2/labels" \
-X GET \
-u u_jsmith@example.com_u0VmztKJrwqf:
Example Response:
{
"labels": [
{
"id": 4,
"name": "Legal"
},
{
"id": 28,
"name": "Medical"
}
],
"page": 1,
"perPage": 25,
"totalPages": 1,
"totalItems": 1
}
Return a list of labels.
HTTP Request
GET /api/v2/labels
Request Parameters
| Name | Type | Description | Default Value |
|---|---|---|---|
names (optional) |
string | Show only labels with the given names as a comma-separated list of substrings | |
sortBy (optional) |
string | Sort the returning list by either id or name | id |
Returns
Returns a list of labels as a LabelList object with the following attributes:
| Name | Type | Description |
|---|---|---|
labels |
array of labels | List of labels as an array of labels (expanded below) |
→ id |
int | Id of the label |
→ name |
string | Name of the label |
page |
int | Page number returned |
perPage |
int | Number of labels returned per page |
totalPages |
int | Total number of pages available |
totalItems |
int | Total number of labels |
Create a label
Example Request:
curl "https://controller-host:8001/api/v2/labels" \
-X POST \
-u u_jsmith@example.com_u0VmztKJrwqf: \
-d name="Health"
Example Response:
{
"id": 28,
"name": "Health"
}
Create a label.
HTTP Request
POST /api/v2/labels
Request Parameters
| Name | Type | Description | Default Value |
|---|---|---|---|
name (optional) |
string | Name of the label to be created |
Returns
Returns the created label.
Update a label
Example Request:
curl "https://controller-host:8001/api/v2/labels/28" \
-X PUT \
-u u_jsmith@example.com_u0VmztKJrwqf: \
-d name="NewHealth"
Example Response:
{
"id": 28,
"name": "NewHealth"
}
Update a label to a new name.
HTTP Request
PUT /api/v2/labels/{labelId}
Path Parameters
| Name | Type | Description |
|---|---|---|
labelId |
int | Id of the label to be updated |
Request Parameters
| Name | Type | Description | Default Value |
|---|---|---|---|
name (optional) |
string | Name of the label to be updated to |
Returns
Returns the updated label.
Delete a label
Example Request:
curl "https://controller-host:8001/api/v2/labels/28" \
-X DELETE \
-u u_jsmith@example.com_u0VmztKJrwqf:
Example Response:
{
"id": 28,
"name": "Medical"
}
Delete a label.
HTTP Request
DELETE /api/v2/labels/{labelId}
Path Parameters
| Name | Type | Description |
|---|---|---|
labelId |
int | Identifier of the label to be deleted |
Returns
Returns the deleted label.
Delete labels
Example Request:
curl "https://controller-host:8001/api/v2/labels/batch-delete" \
-X DELETE \
-u u_jsmith@example.com_u0VmztKJrwqf: \
-d labelIds="28"
Example Response:
{
"id": 28,
"name": "Medical"
}
Delete labels.
HTTP Request
DELETE /api/v2/labels/batch-delete
Request Parameters
| Name | Type | Description | Default Value |
|---|---|---|---|
labelIds (optional) |
int | Comma separated identifiers of labels to be deleted | |
names (optional) |
string | Delete only labels with the given names as a comma-separated list of substrings |
Returns
Returns the number of deleted labels.