cURL
curl -X POST \
/customers/{customerId}/addresses \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"countryCode": "DE",
"vatId": "DE123456789",
"companyName": "Acme Inc.",
"street": "Musterstra\u00dfe 1",
"houseNumber": "1a",
"zip": "12345",
"city": "Berlin",
"addition": "c\/o John Doe",
"costCentre": "12345"
}'import requests
url = "https://coreapi.io/customers/{customerId}/addresses"
payload = {
"countryCode": "DE",
"firstName": "John",
"lastName": "Doe",
"vatId": "DE123456789",
"companyName": "Acme Inc.",
"street": "Musterstraße 1",
"houseNumber": "1a",
"zip": "12345",
"city": "Berlin",
"addition": "c/o John Doe",
"salutation": "Herr",
"costCentre": "12345",
"type": "TYPE_DEFAULT"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
countryCode: 'DE',
firstName: 'John',
lastName: 'Doe',
vatId: 'DE123456789',
companyName: 'Acme Inc.',
street: 'Musterstraße 1',
houseNumber: '1a',
zip: '12345',
city: 'Berlin',
addition: 'c/o John Doe',
salutation: 'Herr',
costCentre: '12345',
type: 'TYPE_DEFAULT'
})
};
fetch('https://coreapi.io/customers/{customerId}/addresses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/customers/{customerId}/addresses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'countryCode' => 'DE',
'firstName' => 'John',
'lastName' => 'Doe',
'vatId' => 'DE123456789',
'companyName' => 'Acme Inc.',
'street' => 'Musterstraße 1',
'houseNumber' => '1a',
'zip' => '12345',
'city' => 'Berlin',
'addition' => 'c/o John Doe',
'salutation' => 'Herr',
'costCentre' => '12345',
'type' => 'TYPE_DEFAULT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"vatId": "DE123456789",
"type": "TYPE_DEFAULT",
"default": "true",
"status": "active",
"city": "Berlin",
"zip": "12345",
"street": "Musterstraße",
"houseNumber": "1a",
"countryCode": "DE",
"companyName": "ACME Inc.",
"salutation": "Herr",
"addition": "c/o John Doe",
"costCentre": "123456789",
"firstName": "John",
"lastName": "Doe"
}Address
Add a customer address
Add a customer address. A new address is set as default for the given address type.
Required permissions:customer:writePOST
/
customers
/
{customerId}
/
addresses
cURL
curl -X POST \
/customers/{customerId}/addresses \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"countryCode": "DE",
"vatId": "DE123456789",
"companyName": "Acme Inc.",
"street": "Musterstra\u00dfe 1",
"houseNumber": "1a",
"zip": "12345",
"city": "Berlin",
"addition": "c\/o John Doe",
"costCentre": "12345"
}'import requests
url = "https://coreapi.io/customers/{customerId}/addresses"
payload = {
"countryCode": "DE",
"firstName": "John",
"lastName": "Doe",
"vatId": "DE123456789",
"companyName": "Acme Inc.",
"street": "Musterstraße 1",
"houseNumber": "1a",
"zip": "12345",
"city": "Berlin",
"addition": "c/o John Doe",
"salutation": "Herr",
"costCentre": "12345",
"type": "TYPE_DEFAULT"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
countryCode: 'DE',
firstName: 'John',
lastName: 'Doe',
vatId: 'DE123456789',
companyName: 'Acme Inc.',
street: 'Musterstraße 1',
houseNumber: '1a',
zip: '12345',
city: 'Berlin',
addition: 'c/o John Doe',
salutation: 'Herr',
costCentre: '12345',
type: 'TYPE_DEFAULT'
})
};
fetch('https://coreapi.io/customers/{customerId}/addresses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/customers/{customerId}/addresses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'countryCode' => 'DE',
'firstName' => 'John',
'lastName' => 'Doe',
'vatId' => 'DE123456789',
'companyName' => 'Acme Inc.',
'street' => 'Musterstraße 1',
'houseNumber' => '1a',
'zip' => '12345',
'city' => 'Berlin',
'addition' => 'c/o John Doe',
'salutation' => 'Herr',
'costCentre' => '12345',
'type' => 'TYPE_DEFAULT'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"vatId": "DE123456789",
"type": "TYPE_DEFAULT",
"default": "true",
"status": "active",
"city": "Berlin",
"zip": "12345",
"street": "Musterstraße",
"houseNumber": "1a",
"countryCode": "DE",
"companyName": "ACME Inc.",
"salutation": "Herr",
"addition": "c/o John Doe",
"costCentre": "123456789",
"firstName": "John",
"lastName": "Doe"
}Autorisierungen
Body
application/jsontext/html
The new CustomerAddress resource
Antwort
CustomerAddress resource created
War diese Seite hilfreich?