Adres Yönetimi Genel bakış
Adres Yönetimi - Genel Bakış Adres Sil Şehirleri Listele Ülkeleri Listele İlçeleri Listele Mahalleleri Listele Sokakları Listele Kullanıcı Adreslerini Listele Adres Detayı Varsayılan Adresleri Getir Alıcı Adresi Detayı Tüm Gönderici Adresleri Kullanıcı Gönderici Adresleri Gönderici Adresi Detayı Yeni Adres Oluştur Adres Güncelle
Yeni Adres Oluştur
POST
/v1/addresses/{USER_ID} Detaylı Açıklama
Section titled “Detaylı Açıklama” POST
/v1/addresses/{USER_ID} 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”{ "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/{USER_ID}', { 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/{USER_ID}');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}