Adres Yönetimi Genel bakış
Adres Yönetimi - Genel Bakış Yeni Adres Oluştur Tüm Gönderici Adresleri Gönderici Adresi Detayı Kullanıcı Adreslerini Listele Kullanıcı Gönderici Adresleri Alıcı Adresi Detayı Varsayılan Adresleri Getir Adres Detayı Adres Güncelle Adres Sil Ülkeleri Listele Şehirleri Listele İlçeleri Listele Mahalleleri Listele Sokakları Listele
Yeni Adres Oluştur
Açıklama
Section titled “Açıklama” POST
/v1/addresses/0 Gönderici (sender) veya alıcı (receiver) olarak sisteme yeni bir kargo adresi ekler.
Parametreler
Section titled “Parametreler”| Parametre | Konum | Tip | Açıklama | Varsayılan | Örnek |
|---|---|---|---|---|---|
| Authorization * | header | string | Bearer Yetkilendirme Tokeni (Örn: Bearer eyJhb...) | - | Bearer <TOKEN> |
| USER_ID * | path | string | İşlem yapan kullanıcının kimlik (ID) değeri. UUID formatındadır. | - | - |
İstek Gövdesi
Section titled “İstek Gövdesi”| Alan | Tip | Açıklama |
|---|---|---|
| type | string | Adresin türü ('sender' veya 'receiver') |
| title | string | Kullanıcının anlayacağı adres başlığı (Örn: 'Evim', 'Merkez Depo') |
| location | object | |
| by | object | Teslimatta sorumlu kişinin iletişim verisi |
| others | object |
{ "type":"receiver", "title":"deneme adresi 24", "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"tr" }, "province":{ "id":"", "title":"", "code":"" }, "city":{ "id":"0", "title":"Samsun", "code":"" }, "district":{ "id":"0", "title":"Çarşamba", "code":"" }, "neighborhood":{ "id":"0", "title":"", "code":"" }, "street":{ "id":"0", "title":"", "code":"" }, "address":{ "line1":"2010 sitesi 1", "line2":"2010 sitesi 2", "line3":"2010 sitesi 3" }, "postCode":"" }, "by":{ "entity":"Yusuf Yasir Kaygusuz", "phone1":{ "phoneCountryCode":"90", "number":"5413234321" }, "phone2":{ "phoneCountryCode":"90", "number":"5413234322" }, "phone3":{ "phoneCountryCode":"90", "number":"5413234323" }, "email":"yasirkaygusuzone@hotmail.com" }, //"invoice":{ // "eInvoice":false, // "taxDepartment":"", // "taxNumber":"" //}, "others":{ // "tag":"", // "isActive":"false", // "latitude":0.1233213, // "longitude":0.1233213 }}Örnek Kod
Section titled “Örnek Kod”fetch('https://api.kargomucuz.com/v1/addresses/0', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <YOUR_TOKEN>' }, body: JSON.stringify({ "type":"receiver", "title":"deneme adresi 24", "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"tr" }, "province":{ "id":"", "title":"", "code":"" }, "city":{ "id":"0", "title":"Samsun", "code":"" }, "district":{ "id":"0", "title":"Çarşamba", "code":"" }, "neighborhood":{ "id":"0", "title":"", "code":"" }, "street":{ "id":"0", "title":"", "code":"" }, "address":{ "line1":"2010 sitesi 1", "line2":"2010 sitesi 2", "line3":"2010 sitesi 3" }, "postCode":"" }, "by":{ "entity":"Yusuf Yasir Kaygusuz", "phone1":{ "phoneCountryCode":"90", "number":"5413234321" }, "phone2":{ "phoneCountryCode":"90", "number":"5413234322" }, "phone3":{ "phoneCountryCode":"90", "number":"5413234323" }, "email":"yasirkaygusuzone@hotmail.com" }, //"invoice":{ // "eInvoice":false, // "taxDepartment":"", // "taxNumber":"" //}, "others":{ // "tag":"", // "isActive":"false", // "latitude":0.1233213, // "longitude":0.1233213 } })}).then(response => response.json()).then(data => console.log(data));$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kargomucuz.com/v1/addresses/0');curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
$body = <<<'EOD'{ "type":"receiver", "title":"deneme adresi 24", "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"tr" }, "province":{ "id":"", "title":"", "code":"" }, "city":{ "id":"0", "title":"Samsun", "code":"" }, "district":{ "id":"0", "title":"Çarşamba", "code":"" }, "neighborhood":{ "id":"0", "title":"", "code":"" }, "street":{ "id":"0", "title":"", "code":"" }, "address":{ "line1":"2010 sitesi 1", "line2":"2010 sitesi 2", "line3":"2010 sitesi 3" }, "postCode":"" }, "by":{ "entity":"Yusuf Yasir Kaygusuz", "phone1":{ "phoneCountryCode":"90", "number":"5413234321" }, "phone2":{ "phoneCountryCode":"90", "number":"5413234322" }, "phone3":{ "phoneCountryCode":"90", "number":"5413234323" }, "email":"yasirkaygusuzone@hotmail.com" }, //"invoice":{ // "eInvoice":false, // "taxDepartment":"", // "taxNumber":"" //}, "others":{ // "tag":"", // "isActive":"false", // "latitude":0.1233213, // "longitude":0.1233213 }}EOD;curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$headers = array();$headers[] = 'Content-Type: application/json';$headers[] = 'Authorization: Bearer <YOUR_TOKEN>';curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);if (curl_errno($ch)) { echo 'Error:' . curl_error($ch);}curl_close($ch);echo $result;Yanıtlar
Section titled “Yanıtlar”200: Başarılı
{ "status": true, "message": "Endpoint bulunamadı.", "code": 500}401: Yetkisiz
{ "status": false, "message": "Herhangi bir giriş sağlanmadı.", "code": 500}