API ORDER COURSIER.FR V4 (EN)
| 08/06/2020 | ![]() |
Version 4.1 |
Objective
Be able to order a courier directly from a website, an intranet or any application from a partner. The API allows to specify the pick-up address, the shipping address, the packages information, the level of service and customer references. It can be called directly without the API GetPrice if you already know the service to use.
Protocol
Requests are made via HTTPS with the url api.coursier.fr/v4/order.php, we get a copy of the order, an ID and the hourly comitments.
Authentication
The authentication happens with an apikey paired to your coursier.fr user, these informations can be found in your customer area. You must have a monthly billing account, if it is not the case, you may contact a salesman at commercial@coursier.fr. You must give as parameters the apikey, the user and the customer account used (a user can be associated with several customer accounts).
In order to test our APIs, as of now you may use the following testing account to begin your developping tasks while you wait for your definitive credentials :
User : test@apicfr.fr
Pass : T3stCFR*
ClientId : 7055339
Apikey : e1ab1411d66765e73cf4b068d39cda8a
Parameters
Parameters must be send in a JSON array using the POST method.
|
NAME |
REQUIRED |
TYPE |
DESCRIPTION |
|
User |
Y |
Varchar(180) |
User to access the coursier.fr interfaces |
|
Apikey |
Y |
Varchar(32) |
Apikey linked to your user |
|
ClientId |
Y |
int |
Customer account number |
|
FromAddress.Company |
Y |
Varchar(50) |
Name of the pick-up enterprise in case of a company |
|
FromAddress.Address |
Y |
Varchar(120) |
Number and street of pick-up address |
|
FromAddress.PostalCode |
Y |
Varchar(10) |
Zipcode of pick-up address |
|
FromAddress.City |
Y |
Varchar(50) |
Pick-up city |
|
FromAddress.Country |
Y |
Varchar(50) |
Pick-up country in full (example : France) |
|
FromAddress.Contact |
Y |
Varchar(50) |
Pick-up contact |
|
FromAddress.Email |
N |
Varchar(100) |
Pick-up email |
|
FromAddress.PhoneNumber |
Y |
Varchar(30) |
Pick-up phone number |
|
FromAddress.Comment |
N |
Varchar(100) |
Comment on the pick-up. The information is registered with the created contact, therefore it must be linked with the address or the contact such as a door code, a direction (dont enter a package number for example) |
|
ToAddress.Company |
N |
Varchar(50) |
Name of company to deliver in the case of a company |
|
ToAddress.Address |
Y |
Varchar(120) |
Number and street of shipping address |
|
ToAddress.PostalCode |
Y |
Varchar(10) |
Zipcode of shipping address |
|
ToAddress.City |
Y |
Varchar(50) |
Shipping city |
|
ToAddress.Country |
Y |
Varchar(50) |
Shipping country in full (example : France) |
|
ToAddress.Contact |
Y |
Varchar(50) |
Shipping contact |
|
ToAddress.Email |
N |
Varchar(100) |
Shipping email |
|
ToAddress.PhoneNumber |
Y |
Varchar(30) |
Shipping phone number |
|
ToAddress.Comment |
N |
Varchar(100) |
Comment on the shipping. The information is registered with the created contact, therefore it must be linked with the address or the contact such as a door code, a direction (dont enter a package number for example) |
|
ServiceId |
Y |
int |
Nature of the service in the form of an ID based on contractual agreements. These IDs are given to you as you create your account and can also be fetched in real time by calling the API Devis, which will return the available services for your account and the given date. To test (1=normal delivery, 2=exclusive delivery, 3= double exclusive delivery, 10 = delivery with 2h slot) |
|
StartDate |
N |
DateTime |
Default value is now. Allows to specify a delayed date to take into accout a cutoff for example. In the case of a slot, it is the beginning of the slot. |
|
Reference1 |
N |
Varchar(50) |
Internal reference of the client, we can split or regroup your invoices by reference1 on demand. |
|
Reference2 |
N |
Varchar(50) |
Internal reference of the client, we can split or regroup your invoices by reference2 on demand. |
|
Reference3 |
N |
Varchar(50) |
Internal reference of the client, we can split or regroup your invoices by reference3 on demand. |
|
Packages |
Y |
Array() |
Array of the packages |
Packages :
|
NAME |
REQUIRED |
TYPE |
DESCRIPTION |
|
Name |
Y |
Varchar(32) |
Free text describing the package, could be parcel, bag, palet... For security reasons, don't specify the nature of the good if it's a high value item. |
|
NumberOfPackage |
Y |
Int |
Number of packages of this size |
|
Weight |
Y |
double |
Weight in kilos |
|
Length |
Y |
Double |
Length in cm |
|
Width |
Y |
double |
Width in cm |
|
Height |
Y |
Double |
Height in cm |
If you lack the exact measurements of your packages, you may refer to the standard grid below.
| Name | Weight | Length | Width | Height | Example |
| XS | 1 | 30 | 20 | 5 | Fold |
| S | 3 | 30 | 25 | 25 | Small package |
| M | 5 | 40 | 30 | 30 | Medium package |
| L | 15 | 60 | 40 | 40 | Big package |
| XL | 100 | 80 | 60 | 100 | Half pallet |
| XXL | 250 | 80 | 120 | 100 | Pallet |
Wrong package measurements may lead to a supplement and a delivery delay.
JSON Response
The response contains the detail of the registered delivery including the ID which allows its tracking. In case of load failure, two deliveries with the same number will be created and visible with the tracking API to watch each of the routes. In case of error, the API returns a JSON with a Message field specifying the nature of the error.
|
NAME |
TYPE |
DESCRIPTION |
|
MissionNumber |
int |
Number of the delivery, this number is the key to interact with our courier, the customer service and the tracking API. |
|
PickupStartDate |
Datetime |
Beginning of the pick-up slot |
|
PickupEndDate |
Datetime |
End of the pick-up slot |
|
DeliveryStartDate |
Datetime |
Beginning of the shipping slot |
|
DeliveryEndDate |
Datetime |
End of the shipping slot |
|
price |
Float |
Pre-tax price of the delivery |
|
CO2 |
Float |
CO2 emissions of the delivery (inkg) |
|
TrackingUrl |
Varchar(256) |
Url for tracking and reschedule information |
|
TrackingKey |
varchar(8) |
tracking number to be used with https://iris.coursier.fr/order/xxxxxxxx |
API call example
<?php
$url = "https://api.coursier.fr/v4/order.php";
$data = array('User' => 'test@apicfr.fr',
'Apikey' => 'e1ab1411d66765e73cf4b068d39cda8a',
'ClientId' => '7055339',
'ServiceId' => 10, //Correspond à un service de créneau
'StartDate' => '2020-07-01 10:00:00', //Mettre un début de créneau valide
'FromAddress' => array('Company' => 'Worldcompany',
'Address' => '45 Rue la Boétie',
'PostalCode' => '75008',
'City' => 'Paris',
'Country' => 'France',
'Contact' => 'Yann Thebault',
'PhoneNumber' => '0602030405',
'Email' => 'yt@test.com',
'Comment' => '5ème étage à gauche'),
'ToAddress' => array('Company' => 'Coursier.fr',
'Address' => '50 Rue Maurice Arnoux',
'PostalCode' => '92120',
'City' => 'Montrouge',
'Country' => 'France',
'Contact' => 'Sophie Mayeux',
'PhoneNumber' => '0605040302',
'Email' => 'sma@test.com',
'Comment' => 'Déposer le colis à l\'accueil'),
'Packages' => array(array('Name' => 'M', 'NumberOfPackage' => 1, 'Weight' =>5, 'Length' => '40', 'Width' => '30', 'Height' => '30')),
'Reference1' => 'Your internal data',
'Reference2' => 'Your internal data',
'Reference3' => 'Your internal data',
'Lang' => 'FR',
);
$datajson = json_encode($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $datajson);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($curl);
curl_close($curl);
var_dump($res);
?>
Response example
{"MissionNumber":"9999999","PickupStartDate":"2020-06-22 18:20:09","PickupEndDate":"2020-06-22 19:20:09","DeliveryStartDate":"2020-06-22 19:20:09","DeliveryEndDate":"2020-06-22 21:20:09","price":99.99,"CO2":2.5,"TrackingUrl":"https://iris.coursier.fr/order/DDDDDDDD","TrackingKey":"DDDDDDDD"}

No Comments