updateCategory
Requires permission categories:category:update.
Updates a category, including moving it under another parent, which also updates the level and path of its subcategories. A code already used by another active category is refused, and so is a parent that would create a loop. Requires permission to update categories.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation UpdateCategory($input: UpdateCategoryInput!) {
updateCategory(input: $input) {
id
code
name
createdAt
childrenCount
deletedAt
children {
id
code
name
createdAt
childrenCount
deletedAt
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation UpdateCategory($input: UpdateCategoryInput!) {\n updateCategory(input: $input) {\n id\n code\n name\n createdAt\n childrenCount\n deletedAt\n children {\n id\n code\n name\n createdAt\n childrenCount\n deletedAt\n }\n }\n}",
"variables": {
"input": {
"id": "id"
}
}
}
EOF
Variables:
{
"input": {
"id": "id"
}
}
Response:
{
"data": {
"updateCategory": {
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z",
"children": [
{
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
updateCategory(
input: UpdateCategoryInput!
): Category!
Arguments
updateCategory.input ● UpdateCategoryInput! non-null input
The ID of the category and the fields to change.
Type
Category object
A node in the category tree. A root category is an ordinary category.