Create a Post

Method URL Content Type
POST post/create application/json

Description

- The method used to create a post.

Required Headers

Parameter Type Required  Description 
Authorization Bearer yes The token you get from the auth/login method

 

Required Parameters [out of posts array]

Parametre ismi Tip Zorunluluk  Açıklama 
platform string no Ex : ticimax, shopify, ideasoft

Required Parameters [in posts array]

Parameter Type Required  Description
reference_id string no A unique identifier for the post.
carrier_id integer yes The ID of the carrier responsible for the post delivery.
post_type (*) integer yes The type of the post. Allowed values: 1, 2, 3, 4.
cod_payment_type (*) integer || string ("") no The type of payment method for the post. Allowed values: 1, 2 or string ""
sender.name string yes The name of the sender.
sender.phone string yes The phone number of the sender.
sender.email string yes The email address of the sender.
sender.address string yes The address of the sender.
sender.country string yes The country code of the sender. (Ex: tr)
sender.city string yes The city of the sender.
sender.district string yes The district of the sender.
sender.post_code string no The postal code of the sender's location.
recipient.name string yes The name of the recipient.
recipient.phone string yes The phone number of the recipient.
recipient.email string yes The email address of the recipient.
recipient.address string yes The address of the recipient.
sender.country string yes The country code of the recipient. (Ex: tr)
recipient.city string yes The city of the recipient.
recipient.district string yes The district of the recipient.
recipient.post_code string no The postal code of the recipient's location.
post.desi decimal yes The weight of the post.
post.package_count integer yes The number of packages in the post.
post.price (*) decimal no The price of the post.
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.

Parameter Value Description 
(*) post_type 1 Same Day Delivery
(*) post_type 2 Standard Delivery
(*) post_type
3 Return
(*) cod_payment_type 1 Cash on delivery
(*) cod_payment_type 2 Credit Cart on delivery
(*) post.price 1.00 It will be sent if the cod_payment_type field is 1 or 2.

<?php 

$data = [
        "platform" => "",
        "posts"=> 
        [
            [
                "reference_id"=> "",
                "carrier_id"=> 7,
                "post_type"=> 1,
                "cod_payment_type"=> "",
                "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"=> [
                    "desi"=> 2.2,
                    "package_count"=> 1,
                    "price"=> "",
                    "note"=> ""
                ],
                "barcode_format"=> "", // html,pdf-A5,pdf-A6,pdf-A6Y,pdf-A7
                "custom_data_1"=> "",
                "custom_data_2"=> "",
                "custom_data_3"=> "",
                "custom_data_4"=> ""
            ]
        ]
];

$payload = json_encode($data);

$ch = curl_init('__APIURL__/post/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, 
array(
   'X-localization : en',
   'Content-Type : application/json',
   'Authorization : Bearer __TOKEN__',
));

$result = curl_exec($ch);

curl_close($ch);

print_r($result);

?>

Sample Responses

{
  "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": 2,
    "post_type_name": "Standart Teslimat",
    "cod_payment_type": 0,
    "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": ""
        "latitude": "123.456",
        "longitude": "456.789"
    },
    "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": {
        "desi": 2.2,
        "package_count": 1,
        "price": "",
        "note": ""
    },
    "custom_data_1": "",
    "custom_data_2": "",
    "custom_data_3": "",
    "custom_data_4": "",
    "created_at": "2022-02-28 14:30:00",
    "updated_at": "2022-02-28 15:30:00"
  }
}