İçeriğe geç

Gönderi (Kargo) Oluştur

POST /v1/shipments/{USER_ID}
POST /v1/shipments/{USER_ID}

Alıcı, gönderici ve koli bilgileri girilerek yeni bir kargo taşıma kaydı oluşturulmasını sağlar.

ParametreKonumTipAçıklamaVarsayılanÖrnek
Authorization * headerstringBearer Yetkilendirme Tokeni (Örn: Bearer eyJhb...)-Bearer <TOKEN>
USER_ID * pathstringİşlem yapan kullanıcının kimlik (ID) değeri. UUID formatındadır.--
{
"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
}
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));
200: Başarılı
{
"status": true,
"message": "Endpoint bulunamadı.",
"code": 500
}
401: Yetkisiz
{
"status": false,
"message": "Herhangi bir giriş sağlanmadı.",
"code": 500
}
504: Gateway Timeout