Skip to main content

Create products

To create multiple products at once, use the mutation batchCreateProducts. This mutation accepts BatchProductInput and returns a job, which provides a reference to the batch job. You can then use this reference to check the status of your batch with the query job-status.

A prerequisite is that you must be authenticated as an administrator with the right to edit products.

Below is an example of how you can perform your import.

Request:

mutation batchCreate{
batchCreateProducts(
input: [
{id: "prod123", stock: 10},
{id: "prod124", stock: 10},
]
) {
id
status
}
}

Response:

{
"data": {
"batchCreateProducts": {
"id": 156,
"status": "waiting"
}
}
}

Check status of your job

Request:

query status {
jobStatus(id: 156) {
id
status
}
}

Response:

{
"data": {
"jobStatus": {
"id": 156,
"status": "completed"
}
}
}