Skip to main content

bulkImportCategories

Requires permission categories:category:create.

Imports categories from a CSV or spreadsheet file. By default it only validates the file and reports each row's errors without saving. Set updateExisting to also update categories whose code already exists, which needs permission to update categories. Requires permission to create 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:

mutation BulkImportCategories($input: BulkCategoryImportInput!) {
bulkImportCategories(input: $input) {
created
failed
success
totalRows
updated
errors {
code
errors
row
}
}
}

Variables:

{
"input": {
"fileContent": "string",
"format": "CSV",
"updateExisting": true,
"validateOnly": true
}
}

Response:

{
"data": {
"bulkImportCategories": {
"created": 0,
"failed": 0,
"success": 0,
"totalRows": 0,
"updated": 0,
"errors": [
{
"code": "string",
"errors": [
"string"
],
"row": 0
}
]
}
}
}
bulkImportCategories(
input: BulkCategoryImportInput!
): BulkCategoryImportResult!

Arguments​

bulkImportCategories.input ● BulkCategoryImportInput! non-null input​

The file content, its format, whether to only validate, and whether to update existing categories.

Type​

BulkCategoryImportResult object​

The outcome of a category import.