Updating Categories
Inside this guide:
Introduction
Update a category
Next steps
Introduction
The updateCoreProductCategory mutation allows you to update a Category.
Update a category
Constructing the mutation and input
We'll be using the API Console to save time having to authenticate. Copy and paste this into your API console query section to get started. Reminder that fields can be removed from the query if you don't want the API to return them.
POST /graphql
Query
mutation ($input: UpdateCoreProductCategoryInput!) {
updateCoreProductCategory(input: $input) {
coreProductCategory {
id
name
}
errors {
path
message
}
}
}
Defining the variables
Copy and paste the block below into the query variables section of the API console and substitute the CATEGORY_ID with the id of the category you want to update.
Variables
{
"input": {
"id": ACCOUNT_ID,
"name": "Clothing"
}
}
Now press Execute Query (the play button) to send the request.
You should get back this response containing all the category you updated.
JSON Response
{
"data": {
"updateCoreProductCategory": {
"coreProductCategory": {
"name": "Clothing",
"id": "73c513ce-c584-46e4-9c51-ddb7aba22575"
},
"errors": null
}
}
}
Next Steps
- Create Category - Learn how to create a category
- Query Category - Learn how to query a category
- Update Category - Learn how to update a category
- Delete Category - Learn how to delete a category
- Making your first call - If you're not sure how GraphQL works, start here.