Przejdź do głównej zawartości

withdrawFoil

Dla: Programista

MutacjaBetaMutation.withdrawFoil

Issues foil from stock (production, waste, a correction, a return to the supplier): books a movement and lowers the stock by the rolls the sheets take (sheets x sheet length / Foil.metersPerRoll). Refused when it takes more than the stock (STOCK_INSUFFICIENT) or when the foil has no meters per roll (STOCK_UNIT_NOT_CONVERTIBLE). Not idempotent: retry with Idempotency-Key. Answers with the foil after the issue.

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.

inputwymaganeWithdrawFoilInput!

The sheets cut and what for.

Zwraca

Foil!

Przykład

Mutacja
mutation IssueFoil($id: ID!, $input: WithdrawFoilInput!) {
withdrawFoil(id: $id, input: $input) {
id
numberOfRolls
}
}
Zmienne
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"input": {
"numberOfSheets": 400,
"sheetLengthMm": 720,
"withdrawalType": "PRODUCTION",
"orderId": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d"
}
}
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 IssueFoil($id: ID!, $input: WithdrawFoilInput!) {\n withdrawFoil(id: $id, input: $input) {\n id\n numberOfRolls\n }\n}",
"variables": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"input": {
"numberOfSheets": 400,
"sheetLengthMm": 720,
"withdrawalType": "PRODUCTION",
"orderId": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d"
}
}
}
JSON
Odpowiedź
{
"data": {
"withdrawFoil": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"numberOfRolls": 2.56
}
}
}