MutacjaBetaMutation.updateProduct
Changes a product: fields left out keep their values. The order must not be archived. Sending the same values again changes nothing, not even Order.updatedAt.
| Wymagany zakres | orders:write |
|---|---|
| Dostępne od | Prynt 0.28.0 |
| Stabilność | Beta (co to znaczy) |
| Ponawianie | Operacja idempotentna: ponowienie bez nagłówka Idempotency-Key jest bezpieczne. Zapisy i idempotencja |
Argumenty
| Nazwa | Typ | Opis |
|---|---|---|
idwymagane | ID! | Identifier of the product to change. |
inputwymagane | UpdateProductInput! | What to change: fields left out keep their values. An explicit null is refused unless the field says otherwise. |
Zwraca
Przykład
mutation ChangeProduct($id: ID!, $input: UpdateProductInput!) { updateProduct(id: $id, input: $input) { id name quantity unit }}{ "id": "be5a7192-4d6f-4a81-9cad-2e3f4a5b6c74", "input": { "quantity": 1000, "price": 190 }}curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \ -H "Authorization: Bearer $PRYNT_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @- <<'JSON'{ "query": "mutation ChangeProduct($id: ID!, $input: UpdateProductInput!) {\n updateProduct(id: $id, input: $input) {\n id\n name\n quantity\n unit\n }\n}", "variables": { "id": "be5a7192-4d6f-4a81-9cad-2e3f4a5b6c74", "input": { "quantity": 1000, "price": 190 } }}JSON{ "data": { "updateProduct": { "id": "be5a7192-4d6f-4a81-9cad-2e3f4a5b6c74", "name": "Wizytówki", "quantity": 1000, "unit": "PIECES" } }}