API-overzicht
Sla een klantadres op
Kies een handeling voor het request, responsestructuur, toegangsregels en implementatiebron.
SchrijvenGeauthenticeerd
POST/api/v1/addresses
Sla een klantadres op
Sanctum-sessie of bearer-token. Vereiste bearer-bevoegdheid: addresses.create
Verzoek
| Veld | In | Regel |
|---|---|---|
name, line1 | JSON-body | Verplichte strings; elk maximaal 255 tekens. |
city | JSON-body | Verplichte string; maximaal 120. |
postal_code | JSON-body | Verplichte string; maximaal 20. |
country | JSON-body | Verplichte string; precies 2 tekens. |
label | JSON-body | Nullable string; maximaal 80. |
company, line2 | JSON-body | Nullable strings; elk maximaal 255. |
region | JSON-body | Nullable string; maximaal 120. |
phone | JSON-body | Nullable string; maximaal 40. |
is_default_billing, is_default_shipping | JSON-body | Optionele booleans; weggelaten vlaggen worden false, ook bij PATCH. |
properties | JSON-body | Nullable array. Ondersteunde aliassen en voorrang: zie het adresschema hieronder. |
curl --request POST "https://shop.example.test/api/v1/addresses" \
--header 'Accept: application/json' \
--header "Authorization: Bearer $API_TOKEN" \
--header 'Content-Type: application/json' \
--data '{"name":"Alex Example","line1":"Example Street 1","city":"Brussels","postal_code":"1000","country":"BE"}'Antwoord200
Succes: 200
Responsestructuur (notatie, geen opgenomen antwoord)
{ data: Address }Gebruikelijke fouten
| HTTP-status | Betekenis |
|---|---|
401 | unauthenticated: ontbrekende of ongeldige authenticatie. |
403 | unauthorized, insufficient_scope of ip_not_allowed: controleer klantcontext, bevoegdheid en token-IP-beleid. |
422 | validation_error: ongeldige invoer of niet-vervulde domeinvereisten. Betaalinitiatie kan ook payment_failed geven. |
429 | rate_limited: wacht voor een nieuwe poging, vooral bij schrijfverzoeken. |