Przejdź do głównej zawartości

receiveFoil

Dla: Programista

MutacjaBetaMutation.receiveFoil

Receives foil 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 in rolls. The price, currency and supplier on the foil 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 foil 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 foil.

inputwymaganeReceiveFoilInput!

The rolls received.

Zwraca

Foil!

Przykład

Mutacja
mutation ReceiveFoil($id: ID!, $input: ReceiveFoilInput!) {
receiveFoil(id: $id, input: $input) {
id
numberOfRolls
}
}
Zmienne
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"input": {
"rollsToAdd": 4,
"unitPrice": 1.85,
"priceUnit": "m",
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 78/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 ReceiveFoil($id: ID!, $input: ReceiveFoilInput!) {\n receiveFoil(id: $id, input: $input) {\n id\n numberOfRolls\n }\n}",
"variables": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"input": {
"rollsToAdd": 4,
"unitPrice": 1.85,
"priceUnit": "m",
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 78/2026"
}
}
}
JSON
Odpowiedź
{
"data": {
"receiveFoil": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"numberOfRolls": 6.56
}
}
}