Techdocs
Search…
Updating Products
Mutations can be used to update the product catalog in Nosto. The updateProducts mutation allows you to update one or more products at a go.
Any validation errors in the product data are accessible in the response. The entire product object is accessible in the response too. In the event that a product validation error led to the product to not be updated, the response would contain the errors as well as the invalid product data.
The given example updates the product #101 and requests the details of the updated products and any associated errors.
1
curl -0 -v -X POST https://api.nosto.com/v1/graphql \
2
-u ":<token>" \
3
-H 'Content-Type: application/graphql' \
4
-d @- << EOF
5
mutation {
6
updateProducts(products: [
7
{
8
id: "101"
9
productId: "101"
10
url: "http://mridang.dev.nos.to:8890/product.htm"
11
imageUrl: "https://example.com/product/sku-1.jpg"
12
priceCurrencyCode: "EUR"
13
price: 10
14
skus: [
15
{
16
id: "sku-1"
17
name: "One"
18
availability: "InStock"
19
price: 100
20
listPrice: 111
21
imageUrl: "https://example.com/product/sku-1.jpg"
22
}
23
]
24
}
25
]) {
26
result {
27
errors {
28
field
29
message
30
}
31
data {
32
productId
33
}
34
}
35
}
36
}
37
EOF
Copied!
The given example updates the price of #101 and requests the details of the updated products and any associated errors.
1
curl -0 -v -X POST https://api.nosto.com/v1/graphql \
2
-u ":<token>" \
3
-H 'Content-Type: application/graphql' \
4
-d @- << EOF
5
mutation {
6
updateProducts(products: [
7
{
8
id: "101"
9
productId: "101"
10
url: "http://mridang.dev.nos.to:8890/product.htm"
11
price: 10
12
}
13
]) {
14
result {
15
errors {
16
field
17
message
18
}
19
data {
20
productId
21
}
22
}
23
}
24
}
25
EOF
Copied!
Last modified 1yr ago
Copy link