Müşteri Adresleri
Bir müşterinin adres defterini okuyan, ekleyen, güncelleyen ve silen beş uç.
Genel Bakış
Bir müşterinin birden çok adresi olabilir ve faturalar bunlardan birine kesilir. Adres defteri müşteri kaydından ayrı durur.
Adreslerden biri varsayılandır. Yeni bir adresi varsayılan yapmak öncekinin işaretini kaldırır; iki varsayılan adres olamaz.
Bildirim tercihi bitmask olarak saklanır: tek sayı, birden çok tercihi taşır.
Referans
Adresleri Listeleme
Müşterinin adres defterinin tamamını döndürür. Varsayılan adres is_default ile işaretlidir.
Ofis.individual veya corporate.reference/countries.active veya passive.curl 'https://panel.ornek.com/api/v1/admin/clients/42/addresses' \
-H "Authorization: Bearer $API_KEY" \
-H 'Accept: application/json'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/addresses', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/addresses');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->GetClientAddresses(['id' => 42]);
foreach ($response['data'] as $address) {
if ($address['is_default']) {
$invoiceAddress = $address;
}
}Adres Ekleme
Adres defterine yeni bir kayıt ekler ve oluşan adresi listeyle aynı şemada döndürür.
reference/countries.individual veya corporate. Varsayılan individual.201 ile döner. Liste şemasıyla aynıdır.curl -X POST 'https://panel.ornek.com/api/v1/admin/clients/42/addresses' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"full_name":"Ayse Yilmaz","email":"[email protected]","country_id":792,"state":"Marmara","city":"Istanbul","address":"Ornek Cadde 1","zipcode":"34000","is_default":true}'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/addresses', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({"full_name":"Ayse Yilmaz","email":"[email protected]","country_id":792,"state":"Marmara","city":"Istanbul","address":"Ornek Cadde 1","zipcode":"34000","is_default":true}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/addresses');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'full_name' => 'Ayse Yilmaz',
'email' => '[email protected]',
'country_id' => 792,
'state' => 'Marmara',
'city' => 'Istanbul',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->CreateClientAddress([
'id' => 42,
'full_name' => 'Ayse Yilmaz',
'email' => '[email protected]',
'country_id' => 792,
'state' => 'Marmara',
'city' => 'Istanbul',
'is_default' => true,
]);
$addressId = $response['data']['id'] ?? 0;{
"data": {
"id": 13,
"full_name": "Ayse Yilmaz",
"type": "individual",
"country_id": 792,
"city": "Istanbul",
"zipcode": "34000",
"is_default": true,
"status": "active"
}
}{
"error": {
"code": "email_invalid",
"message": "A valid email is required."
}
}Adres Detayı
Tek bir adresi döndürür. Şema listedekiyle aynıdır.
curl 'https://panel.ornek.com/api/v1/admin/clients/42/addresses/13' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->GetClientAddress(['id' => 42, 'addr_id' => 13]);Adres Güncelleme
Adresi günceller. Gövde ekleme ile aynı alanları alır ve zorunlular yine zorunludur.
full_name zorunlu.country_id zorunlu.state zorunlu.city zorunlu.curl -X PUT 'https://panel.ornek.com/api/v1/admin/clients/42/addresses/13' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"full_name":"Ayse Yilmaz","email":"[email protected]","country_id":792,"state":"Marmara","city":"Istanbul","address":"Ornek Cadde 1","zipcode":"34000","is_default":true}'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({"full_name":"Ayse Yilmaz","email":"[email protected]","country_id":792,"state":"Marmara","city":"Istanbul","address":"Ornek Cadde 1","zipcode":"34000","is_default":true}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($address),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Zorunlu alanlar tekrar gönderilir: bu kısmi değil, tam güncellemedir.
$response = Api::Clients()->UpdateClientAddress([
'id' => 42,
'addr_id' => 13,
'full_name' => 'Ayse Yilmaz',
'email' => '[email protected]',
'country_id' => 792,
'state' => 'Marmara',
'city' => 'Istanbul',
]);Adres Silme
Adresi siler ve silinen kimliği döndürür.
curl -X DELETE 'https://panel.ornek.com/api/v1/admin/clients/42/addresses/13' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13', {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/addresses/13');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->DeleteClientAddress(['id' => 42, 'addr_id' => 13]);Tuzaklar
Bir adresi is_default ile işaretlemek önceki varsayılanın işaretini kaldırır. Eski adresi ayrıca güncellemeniz gerekmez; iki varsayılan adres oluşamaz.
Adresi güncellemek daha önce kesilmiş faturalara yansımaz. Yansımasını istiyorsanız overwrite_invoices alanını gönderin.
Uç PUT. Zorunlu alanları göndermezseniz istek reddedilir; yalnız değişen alanı göndermek yetmez.
İlgili Makaleler
Geri bildiriminiz için teşekkürler!
Yukarıda bulamadığınız her şey için destek ekibimiz her zaman yanınızda.