Przejdź do głównej zawartości

createClientAddress

Dla: Programista

MutacjaBetaMutation.createClientAddress

Adds an address to a client. With isDefault, it becomes the default address of its type and the previous default one stops being it.

Wymagany zakresclients: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
clientIdwymaganeID!

Identifier of the client.

inputwymaganeClientAddressInput!

The new address.

Zwraca

ClientAddress!

Przykład

Mutacja
mutation CreateClientAddress($clientId: ID!, $input: ClientAddressInput!) {
createClientAddress(clientId: $clientId, input: $input) {
id
type
name
zip
city
isDefault
}
}
Zmienne
{
"clientId": "6c2e4a1b-7d3f-4e5a-9b8c-0d1e2f3a4b5c",
"input": {
"type": "DELIVERY",
"name": "Magazyn Pruszków",
"street": "Składowa",
"buildingNumber": "3",
"zip": "05-800",
"city": "Pruszków",
"country": "Polska",
"opensAt": "07:00",
"closesAt": "15:00",
"isDefault": true
}
}
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 CreateClientAddress($clientId: ID!, $input: ClientAddressInput!) {\n createClientAddress(clientId: $clientId, input: $input) {\n id\n type\n name\n zip\n city\n isDefault\n }\n}",
"variables": {
"clientId": "6c2e4a1b-7d3f-4e5a-9b8c-0d1e2f3a4b5c",
"input": {
"type": "DELIVERY",
"name": "Magazyn Pruszków",
"street": "Składowa",
"buildingNumber": "3",
"zip": "05-800",
"city": "Pruszków",
"country": "Polska",
"opensAt": "07:00",
"closesAt": "15:00",
"isDefault": true
}
}
}
JSON
Odpowiedź
{
"data": {
"createClientAddress": {
"id": "9f5b7d4e-0a6c-4b8d-8e1f-3a4b5c6d7e8f",
"type": "DELIVERY",
"name": "Magazyn Pruszków",
"zip": "05-800",
"city": "Pruszków",
"isDefault": true
}
}
}