MutacjaBetaMutation.createOrder
Creates an order with its products (and their elements and operations), contact, delivery addresses, billing details and additional costs. The order gets its number and starts as CREATED.
| Wymagany zakres | orders: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 | CreateOrderInput! | The new order. |
Zwraca
Przykład
mutation CreateOrder($input: CreateOrderInput!) { createOrder(input: $input) { id displayId status products { id number name } }}{ "input": { "clientId": "1c7e2b9f-0a3d-4c5e-8f6a-7b8c9d0e1f02", "totalPallets": 0, "totalPackages": 1, "transportMethod": "COURIER", "completionDate": "2026-10-16", "paymentMethod": "ONLINE_PREPAID", "paymentStatus": "PAID", "contact": { "firstName": "Anna", "lastName": "Kowalska", "phone": "+48 600 100 200" }, "deliveries": [ { "contactName": "Anna Kowalska", "street": "Lipowa", "buildingNumber": "12", "zip": "31-002", "city": "Kraków", "country": "PL", "phone": "+48 600 100 200" } ], "products": [ { "number": 1, "name": "Ulotka A5", "quantity": 5000, "unit": "PIECES", "price": 450, "priceMarkup": 0, "taxRate": 23, "weight": 12.5, "description": "Kreda błysk 130 g, druk 4+4" } ] }}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 CreateOrder($input: CreateOrderInput!) {\n createOrder(input: $input) {\n id\n displayId\n status\n products {\n id\n number\n name\n }\n }\n}", "variables": { "input": { "clientId": "1c7e2b9f-0a3d-4c5e-8f6a-7b8c9d0e1f02", "totalPallets": 0, "totalPackages": 1, "transportMethod": "COURIER", "completionDate": "2026-10-16", "paymentMethod": "ONLINE_PREPAID", "paymentStatus": "PAID", "contact": { "firstName": "Anna", "lastName": "Kowalska", "email": "[email protected]", "phone": "+48 600 100 200" }, "deliveries": [ { "contactName": "Anna Kowalska", "street": "Lipowa", "buildingNumber": "12", "zip": "31-002", "city": "Kraków", "country": "PL", "phone": "+48 600 100 200" } ], "products": [ { "number": 1, "name": "Ulotka A5", "quantity": 5000, "unit": "PIECES", "price": 450, "priceMarkup": 0, "taxRate": 23, "weight": 12.5, "description": "Kreda błysk 130 g, druk 4+4" } ] } }}JSON{ "data": { "createOrder": { "id": "5c1e3b74-9f6a-4dac-9043-7e8f9a0b1c23", "displayId": "1092/2026", "status": "CREATED", "products": [ { "id": "c06a8203-5e7f-4192-8dbe-3f4a5b6c7d85", "number": 1, "name": "Ulotka A5" } ] } }}