Update products
To update multiple products at once, use the mutation batchUpdateProducts. 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 updateProducts{
batchUpdateProducts(
input: [
{id:"prod123", stock: 10, name: [{language: "SV", value: "Fin produkt"}]},
{id: "prod124", stock: 10, name: [{language: "SV", value: "Finare produkt"}]},
]
),
{
id
status
}
}
Response:
{
"data": {
"batchUpdateProducts": {
"id": 156,
"status": "waiting"
}
}
}
Check status of your job
Request:
query status {
jobStatus(id: 156) {
id
status
}
}
Response:
{
"data": {
"jobStatus": {
"id": 156,
"status": "completed"
}
}
}