Przejdź do głównej zawartości

receivePaint

Dla: Programista

MutacjaBetaMutation.receivePaint

Receives paint into stock outside purchase orders (for a delivery ordered in Prynt use receivePurchaseOrder): books a movement — with the price, supplier and delivery document given, kept on it as they were — and raises the stock. The price, currency and supplier on the paint card do not change. Not idempotent: retry with Idempotency-Key (one key per receipt written, not per delivery document: one document often holds several lines of one material). Answers with the paint after the receipt.

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 paint.

inputwymaganeReceivePaintInput!

The grams received.

Zwraca

Paint!

Przykład

Mutacja
mutation ReceivePaint($id: ID!, $input: ReceivePaintInput!) {
receivePaint(id: $id, input: $input) {
id
quantityGrams
}
}
Zmienne
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02",
"input": {
"quantityToAdd": 2500,
"unitPrice": 52.3,
"priceUnit": "kg",
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"documentNumber": "WZ 77/2026"
}
}
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 ReceivePaint($id: ID!, $input: ReceivePaintInput!) {\n receivePaint(id: $id, input: $input) {\n id\n quantityGrams\n }\n}",
"variables": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02",
"input": {
"quantityToAdd": 2500,
"unitPrice": 52.3,
"priceUnit": "kg",
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"documentNumber": "WZ 77/2026"
}
}
}
JSON
Odpowiedź
{
"data": {
"receivePaint": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02",
"quantityGrams": 4849.5
}
}
}