Przejdź do głównej zawartości

createSupplier

Dla: Programista

MutacjaBetaMutation.createSupplier

Adds a supplier. Not idempotent: look the supplier up first (e.g. by nip or code), and retry with Idempotency-Key.

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
inputwymaganeCreateSupplierInput!

The new supplier.

Zwraca

Supplier!

Przykład

Mutacja
mutation CreateSupplier($input: CreateSupplierInput!) {
createSupplier(input: $input) {
id
name
code
isActive
}
}
Zmienne
{
"input": {
"name": "Folie-Pol sp. z o.o.",
"code": "FP",
"nip": "1234563218",
"email": "[email protected]",
"phone": "+48 12 345 67 89"
}
}
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 CreateSupplier($input: CreateSupplierInput!) {\n createSupplier(input: $input) {\n id\n name\n code\n isActive\n }\n}",
"variables": {
"input": {
"name": "Folie-Pol sp. z o.o.",
"code": "FP",
"nip": "1234563218",
"email": "[email protected]",
"phone": "+48 12 345 67 89"
}
}
}
JSON
Odpowiedź
{
"data": {
"createSupplier": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b14",
"name": "Folie-Pol sp. z o.o.",
"code": "FP",
"isActive": true
}
}
}