Przejdź do głównej zawartości

addAdditionalCost

Dla: Programista

MutacjaBetaMutation.addAdditionalCost

Adds an additional cost (for example design work) to an order or to one of its products. Refused for an archived order.

Wymagany zakresorders: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
inputwymaganeAddAdditionalCostInput!

The cost and the order or product it is charged on.

Zwraca

AdditionalCost!

Przykład

Mutacja
mutation AddCost($input: AddAdditionalCostInput!) {
addAdditionalCost(input: $input) {
id
orderId
productId
name
category
isClientVisible
}
}
Zmienne
{
"input": {
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"name": "Ekspresowa realizacja",
"category": "RUSH_FEE",
"amount": 80
}
}
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 AddCost($input: AddAdditionalCostInput!) {\n addAdditionalCost(input: $input) {\n id\n orderId\n productId\n name\n category\n isClientVisible\n }\n}",
"variables": {
"input": {
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"name": "Ekspresowa realizacja",
"category": "RUSH_FEE",
"amount": 80
}
}
}
JSON
Odpowiedź
{
"data": {
"addAdditionalCost": {
"id": "d07c93b4-6f81-4ca3-9ecf-4a5b6c7d8e96",
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"productId": null,
"name": "Ekspresowa realizacja",
"category": "RUSH_FEE",
"isClientVisible": true
}
}
}