Przejdź do głównej zawartości

updatePurchaseOrder

Dla: Programista

MutacjaBetaMutation.updatePurchaseOrder

Changes a purchase order that is neither RECEIVED nor CANCELLED: a field left out keeps its value, items replaces the whole item list. Changes of the header and of items sent with their id are safe to repeat — the same values sent again leave the order and PurchaseOrder.updatedAt as they were — but an item without id is added on every call (the copy from an earlier call is removed), so retry with Idempotency-Key. From an API key a new supplier must be active.

Wymagany zakreswarehouse: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 purchase order to change.

inputwymaganeUpdatePurchaseOrderInput!

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

Zwraca

PurchaseOrder!

Przykład

Mutacja
mutation PostponeDelivery($id: ID!, $input: UpdatePurchaseOrderInput!) {
updatePurchaseOrder(id: $id, input: $input) {
id
expectedDeliveryAt
notes
updatedAt
}
}
Zmienne
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"input": {
"expectedDeliveryAt": "2026-10-12T08:00:00.000Z",
"notes": "Dostawca przesunął termin"
}
}
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 PostponeDelivery($id: ID!, $input: UpdatePurchaseOrderInput!) {\n updatePurchaseOrder(id: $id, input: $input) {\n id\n expectedDeliveryAt\n notes\n updatedAt\n }\n}",
"variables": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"input": {
"expectedDeliveryAt": "2026-10-12T08:00:00.000Z",
"notes": "Dostawca przesunął termin"
}
}
}
JSON
Odpowiedź
{
"data": {
"updatePurchaseOrder": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"expectedDeliveryAt": "2026-10-12T08:00:00.000Z",
"notes": "Dostawca przesunął termin",
"updatedAt": "2026-10-06T10:15:00.000Z"
}
}
}