Przejdź do głównej zawartości

updateOrder

Dla: Programista

MutacjaBetaMutation.updateOrder

Changes an order: its fields, status, contact, delivery addresses or billing details. Products are added and changed with createProduct and updateProduct. Order.updatedAt moves only when something really changed: the same values sent again leave it as it was.

Wymagany zakresorders:write
Dostępne odPrynt 0.28.0
StabilnośćBeta (co to znaczy)
PonawianieWysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja

Argumenty

NazwaTypOpis
idwymaganeID!

Identifier of the order to change.

inputwymaganeUpdateOrderInput!

What to change: fields left out keep their values. An explicit null is refused unless the field says otherwise.

Zwraca

Order!

Przykład

Mutacja
mutation UpdateOrder($id: ID!, $input: UpdateOrderInput!) {
updateOrder(id: $id, input: $input) {
id
status
paymentStatus
completionDate
updatedAt
}
}
Zmienne
{
"id": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"input": {
"paymentStatus": "PAID",
"completionDate": "2026-10-20"
}
}
Wywołanie (curl)
IDEMPOTENCY_KEY=$(uuidgen) # ponawiaj z tym samym kluczem
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
--data-binary @- <<'JSON'
{
"query": "mutation UpdateOrder($id: ID!, $input: UpdateOrderInput!) {\n updateOrder(id: $id, input: $input) {\n id\n status\n paymentStatus\n completionDate\n updatedAt\n }\n}",
"variables": {
"id": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"input": {
"paymentStatus": "PAID",
"completionDate": "2026-10-20"
}
}
}
JSON
Odpowiedź
{
"data": {
"updateOrder": {
"id": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"status": "CREATED",
"paymentStatus": "PAID",
"completionDate": "2026-10-20T00:00:00.000Z",
"updatedAt": "2026-10-05T09:41:15.027Z"
}
}
}