Update a product category in Connect

Use the updateProductCategory mutation to modify an existing category. The id argument identifies the category to update; the category input contains the fields to change.

mutation {
  updateProductCategory(
    id: "873d331a-6884-40ab-b87b-cb1a962be758"
    category: {
      categoryId: "7"
      categoryName: "Survival Kits"
      description: "Survival kit category description"
      sourceUrl: "https://store.com/sporting_goods/camping/survival_kits"
      parent: { id: null }
    }
  ) {
    modifiedCount
    category {
      id
      categoryId
      categoryName
      description
      sourceUrl
      namespace
      parentId
      calculatedFields { path depth }
      parent { id categoryName }
      tracking { createdAt createdBy lastModifiedAt lastModifiedBy }
    }
  }
}

Response

{
  "data": {
    "updateProductCategory": {
      "modifiedCount": 1,
      "category": {
        "id": "873d331a-6884-40ab-b87b-cb1a962be758",
        "categoryId": "7",
        "categoryName": "Survival Kits",
        "namespace": "PRIMARY",
        "parentId": null,
        "calculatedFields": { "path": "Survival Kits", "depth": 1 }
      }
    }
  }
}

Authentication

This API uses API Key authentication. See Using the Connect API for instructions on how to get and use your API key.