Skip to main content

API PACKAGE COURSIER.FR V5 (EN)

11/09/2024 image-1662457811981.png Version 5.1


Objective

Be able to update package specifications on an existing order. You can add or remove packages, and/or update packages information. The api takes an array of packages as parameters and replace all current packages of the given mission. As the price may be based on packages size and number, the price of the mission is recalculated and sent in the answer.

Protocol

Requests are made via HTTPS with the url api.coursier.fr/v5/package.php, we get a json confirmation with the mission ids, all the package specifications, and the new price. 

 

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


MissionNumber

Y

int

Id of the mission returned by the order endpoint


Packages

Y

Array()

New array of packages, should contains all the packages of the mission



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.

OR

tracking number for this package in case of multi package tracking

NumberOfPackage

Y

Int

Number of packages of this size. Should be 1 in case of multi package tracking (1 line per package)


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 mission ids, the new packages, the new price and the new CO2 emissions. In case of error, the API returns a JSON with a Message field specifying the nature of the error.

NAME

TYPE

DESCRIPTION

MissionId


int

Id of the leg, there could be many legs for 1 mission number in case of transfer through a hub


MissionNumber

int

Number of the delivery, this number is the key to interact with our courier, the customer service and the tracking API.


Packages

Array()

Array of all new packages


Price

Float

Pre-tax price of the delivery


CO2

Float

CO2 emissions of the delivery (inkg)



API call example
<?php
$url = "https://api.coursier.fr/v4/order.php";
$data = array('User' => 'test@apicfr.fr',
'Apikey' => 'e1ab1411d66765e73cf4b068d39cda8a',
'ClientId' => '7055339',
'MissionNumber' => '99999999',
'Packages' => array(array('Name' => 'M', 'NumberOfPackage' => 1, 'Weight' =>5, 'Length' => '40', 'Width' => '30', 'Height' => '30'))
);

$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

[{"MissionId":"10009998","MissionNumber":"90286366","Packages":[{"Name":"S","NumberOfPackage":1,"Weight":0.5,"Length":"1","Width":"25","Height":"100"}],"price":10,"CO2":1.5}] "