Gönderi (Kargo) Oluştur
POST
/v1/shipments/{USER_ID} Detaylı Açıklama
Section titled “Detaylı Açıklama” POST
/v1/shipments/{USER_ID} Alıcı, gönderici ve koli bilgileri girilerek yeni bir kargo taşıma kaydı oluşturulmasını sağlar.
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”{ "title":"Ptt Standart 2 Kargosu", "explanation":"Ptt standart 2 kargo denemesi", "providerServiceCode":"ptt_standart",
"packageInfo":{ "desiOrKg": "1", "width": "0.01", "height": "0.01", "depth": "0.01", "weight":"0.5", "itemsAmountCurrency":"try", "itemsTaxAmount":0, "itemsAmount":0, "items":[] },
"senderAddress":{ "by":{ "entity":"Yusuf Yasir KAYGUSUZ", "phone1":{ "phoneCountryCode":"90", "number":"5419441858" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"yasirkaygusuzone@gmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Samsun" }, "district":{ "title":"Atakum" }, "neighborhood":{ "title":"Example mah." }, "street":{ "title":"Example. sokak" }, "address":{ "line1":"Example address" //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
"receiverAddress":{ "by":{ "entity":"Ahmet Karpalı", "phone1":{ "phoneCountryCode":"90", "number":"5419441857" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"hakankarpalı55@hotmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Eskişehir" }, "district":{ "title":"Tepebaşi" }, "neighborhood":{ "title":"" }, "street":{ "title":"" }, "address":{ "line1":"Merkez Ptt binası." //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
//"selectedSenderAddressId": "68407104b7de4709b171345b", // => 682f835b2d273102b62f0026 //"selectedReceiverAddressId": "6850253195d32b3947411386", // => 67fcc0f63f154d3f8d97a3a3
"buyerPayShipping": false, "buyerPayProduct": false}Örnek Kod
Section titled “Örnek Kod”fetch('https://api.kargomucuz.com/v1/shipments/{USER_ID}', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <YOUR_TOKEN>' }, body: JSON.stringify({ "title":"Ptt Standart 2 Kargosu", "explanation":"Ptt standart 2 kargo denemesi", "providerServiceCode":"ptt_standart",
"packageInfo":{ "desiOrKg": "1", "width": "0.01", "height": "0.01", "depth": "0.01", "weight":"0.5", "itemsAmountCurrency":"try", "itemsTaxAmount":0, "itemsAmount":0, "items":[] },
"senderAddress":{ "by":{ "entity":"Yusuf Yasir KAYGUSUZ", "phone1":{ "phoneCountryCode":"90", "number":"5419441858" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"yasirkaygusuzone@gmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Samsun" }, "district":{ "title":"Atakum" }, "neighborhood":{ "title":"Example mah." }, "street":{ "title":"Example. sokak" }, "address":{ "line1":"Example address" //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
"receiverAddress":{ "by":{ "entity":"Ahmet Karpalı", "phone1":{ "phoneCountryCode":"90", "number":"5419441857" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"hakankarpalı55@hotmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Eskişehir" }, "district":{ "title":"Tepebaşi" }, "neighborhood":{ "title":"" }, "street":{ "title":"" }, "address":{ "line1":"Merkez Ptt binası." //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
//"selectedSenderAddressId": "68407104b7de4709b171345b", // => 682f835b2d273102b62f0026 //"selectedReceiverAddressId": "6850253195d32b3947411386", // => 67fcc0f63f154d3f8d97a3a3
"buyerPayShipping": false, "buyerPayProduct": false })}).then(response => response.json()).then(data => console.log(data));$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kargomucuz.com/v1/shipments/{USER_ID}');curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
$body = <<<'EOD'{ "title":"Ptt Standart 2 Kargosu", "explanation":"Ptt standart 2 kargo denemesi", "providerServiceCode":"ptt_standart",
"packageInfo":{ "desiOrKg": "1", "width": "0.01", "height": "0.01", "depth": "0.01", "weight":"0.5", "itemsAmountCurrency":"try", "itemsTaxAmount":0, "itemsAmount":0, "items":[] },
"senderAddress":{ "by":{ "entity":"Yusuf Yasir KAYGUSUZ", "phone1":{ "phoneCountryCode":"90", "number":"5419441858" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"yasirkaygusuzone@gmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Samsun" }, "district":{ "title":"Atakum" }, "neighborhood":{ "title":"Example mah." }, "street":{ "title":"Example. sokak" }, "address":{ "line1":"Example address" //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
"receiverAddress":{ "by":{ "entity":"Ahmet Karpalı", "phone1":{ "phoneCountryCode":"90", "number":"5419441857" }, //"phone2":{ // "phoneCountryCode":"", // "number":"" //}, //"phone3":{ // "phoneCountryCode":"", // "number":"" //}, "email":"hakankarpalı55@hotmail.com" }, "location":{ "country":{ "id":"298795", "title":"Türkiye", "code":"TR" }, //"province":{ // "title":"" //}, "city":{ "title":"Eskişehir" }, "district":{ "title":"Tepebaşi" }, "neighborhood":{ "title":"" }, "street":{ "title":"" }, "address":{ "line1":"Merkez Ptt binası." //"line2":"", //"line3":"" } }, "title":"Example", "save":false },
//"selectedSenderAddressId": "68407104b7de4709b171345b", // => 682f835b2d273102b62f0026 //"selectedReceiverAddressId": "6850253195d32b3947411386", // => 67fcc0f63f154d3f8d97a3a3
"buyerPayShipping": false, "buyerPayProduct": false}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}