MutacjaBetaMutation.createPurchaseOrder
Adds a purchase order (status DRAFT) with its items and, from an integration, the integration's own reference (externalRef). From an API key the supplier must be active (Supplier.isActive). Not idempotent: look the order up by externalRef first, and retry with Idempotency-Key.
| Wymagany zakres | warehouse:write |
|---|---|
| Dostępne od | Prynt 0.28.0 |
| Stabilność | Beta (co to znaczy) |
| Ponawianie | Wysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja |
Argumenty
| Nazwa | Typ | Opis |
|---|---|---|
inputwymagane | CreatePurchaseOrderInput! | The new purchase order. |
Zwraca
Przykład
mutation CreatePurchaseOrder($input: CreatePurchaseOrderInput!) { createPurchaseOrder(input: $input) { id code status externalRef items { id description quantity unit } }}{ "input": { "supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06", "currency": "PLN", "expectedDeliveryAt": "2026-10-08T08:00:00.000Z", "externalRef": "SUP-2026-0042", "items": [ { "materialType": "PAPER", "materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b01", "description": "Kreda mat 130g 70x100", "quantity": 2000, "unit": "ark.", "unitPrice": 0.42 }, { "materialType": "PAINT", "materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02", "description": "Pantone 1935 C", "quantity": 5, "unit": "kg", "unitPrice": 180 } ] }}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 CreatePurchaseOrder($input: CreatePurchaseOrderInput!) {\n createPurchaseOrder(input: $input) {\n id\n code\n status\n externalRef\n items {\n id\n description\n quantity\n unit\n }\n }\n}", "variables": { "input": { "supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06", "currency": "PLN", "expectedDeliveryAt": "2026-10-08T08:00:00.000Z", "externalRef": "SUP-2026-0042", "items": [ { "materialType": "PAPER", "materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b01", "description": "Kreda mat 130g 70x100", "quantity": 2000, "unit": "ark.", "unitPrice": 0.42 }, { "materialType": "PAINT", "materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02", "description": "Pantone 1935 C", "quantity": 5, "unit": "kg", "unitPrice": 180 } ] } }}JSON{ "data": { "createPurchaseOrder": { "id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07", "code": "PO-240", "status": "DRAFT", "externalRef": "SUP-2026-0042", "items": [ { "id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b08", "description": "Kreda mat 130g 70x100", "quantity": 2000, "unit": "ark." }, { "id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b09", "description": "Pantone 1935 C", "quantity": 5, "unit": "kg" } ] } }}