Method | URL | Content Type |
---|---|---|
POST | post/update | application/json |
Description
- This method is used to update or modify an existing post. Users or businesses can use this method to communicate changes to existing post information through the API when they want to update it.
- The post-update operation can be performed when the post status is 'Preview' or 'To Be Received'.
- The post-update operation cannot be performed when the post status is 'In Process'. You can update again once the specific process for the post is completed.
Required Headers
Parameter | Type | Required | Description |
---|---|---|---|
Authorization | Bearer | yes | auth token |
Required Parameters
Parameter | Type | Required | Description |
---|---|---|---|
post_number | string | no | A unique identifier for the post. |
sender.name | string | no | The name of the sender. |
sender.phone | string | no | The phone number of the sender. |
sender.email | string | no | The email address of the sender. |
sender.address | string | no | The address of the sender. |
sender.country | string | no | The country code of the sender. (Ex: tr) |
sender.city | string | no | The city of the sender. |
sender.district | string | no | The district of the sender. |
sender.post_code | string | no | The postal code of the sender's location. |
recipient.name | string | no | The name of the recipient. |
recipient.phone | string | no | The phone number of the recipient. |
recipient.email | string | no | The email address of the recipient. |
recipient.address | string | no | The address of the recipient. |
sender.country | string | no | The country code of the recipient. (Ex: tr) |
recipient.city | string | no | The city of the recipient. |
recipient.district | string | no | The district of the recipient. |
recipient.post_code | string | no | The postal code of the recipient's location. |
post.note | string | no | A note for the post. |
barcode_format
|
string | no |
The barcode format code ( html, pdf-A5, pdf-A6, pdf-A6Y, pdf-A7 ) |
custom_data_1 | string | no | Custom data field. |
custom_data_2 | string | no | Custom data field. |
custom_data_3 | string | no | Custom data field. |
custom_data_4 | string | no | Custom data field. |
Sample Requests
<?php
$data = array(
"post_number" => "MFYS29970",
"sender": {
"name": "Taleh Həsənov",
"phone": "+994 111 99 09 08",
"email": "sender@firma.com",
"address": "42 Neftchilar Ave, 1000",
"country": "az",
"city": "Baku",
"district": "",
"post_code": ""
},
"recipient": {
"name": "Akife Məmədov",
"phone": "+994 111 88 11 08",
"email": "akifememedov@gmail.com",
"address": "M9C6+5X3, Mirze Abbas Abbaszada, 44491",
"country": "az",
"city": "Gence",
"district": "",
"post_code": ""
},
"post" => array(
"note" => ""
),
"barcode_format" => "",
"custom_data_1" => "",
"custom_data_2" => "",
"custom_data_3" => "",
"custom_data_4" => ""
);
$payload = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '__APIURL__/post/update');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer __TOKEN__'
));
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
if ($response === false) {
echo 'cURL error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
?>
Sample Responses
{
"status": true,
"message": "The post has been successfully updated.",
"data": {
"post_number": "MFYS29970",
"reference_id": "LDTN64JV124",
"tracking_url": "https://track.carrtell.co/check/MFYS29970",
"barcode_url": "https://barcode.carrtell.co/MFYS29970.pdf",
"post": {
"carrier_id": 7,
"carrier_name": "Azerbaycan Kargo",
"post_type": 1,
"post_type_name": "Standart Teslimat",
"cod_payment_type": null,
"cod_payment_type_name": null,
"sender": {
"name": "Taleh Həsənov",
"phone": "+994 111 99 09 08",
"email": "sender@firma.com",
"address": "42 Neftchilar Ave, 1000",
"country": "az",
"city": "Baku",
"district": "",
"post_code": null,
"latitude": null,
"longitude": null
},
"recipient": {
"name": "Akife Məmədov",
"phone": "+994 111 88 11 08",
"email": "akifememedov@gmail.com",
"address": "M9C6+5X3, Mirze Abbas Abbaszada, 44491",
"country": "az",
"city": "Gence",
"district": "",
"post_code": null
},
"post": {
"desi": 2.2,
"package_count": 1,
"price": 0,
"note": null
},
"custom_data_1": null,
"custom_data_2": null,
"custom_data_3": null,
"custom_data_4": null,
"created_at": "2023-06-01 13:39:46",
"updated_at": "2023-06-01 14:06:12"
}
}
}