API CANCEL COURSIER.FR V3 (EN)

12/11/2020 logo_coursier.png Version 3.1

 

Objective

Cancel a given mission. This can be done until the mission is dispatched to one of our courriers and until 1 hour before the pickup start date. In case of a mission with shuttle, we consider the pickup start date from our hub, not from the customer (which concerns the shuttle).

 

Protocol

Requests are made via HTTPS with the url api.coursier.fr/v3/cancel.php, the response is a JSON containing all the delivery information, which let you do a final check to be sure you've cancelled the right mission. In case of fragmentation, several records will be sent, each with their own information. 

 

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(32)

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 delivery, obtained when placing the order. 

 

Lang

N

varchar(2)

Language code for the retrieval of messages (default ; FR)

 

JSON Response

The response is a JSON array with all the related information to the delivery or the delivery fragment given. 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 delivery, in case of load failure the ID is different for every fragment.

 

MissionNumber

int

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

 

From

varchar(80)

Name of the pick-up address

 

To

varchar(80)

Name of the shipping address

 

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

 

 

API call example
<?php
$Url = "https://api.coursier.fr/v3/cancel.php";
$Data = array('User' => 'test@apicfr.fr',
			  'Apikey' => 'e1ab1411d66765e73cf4b068d39cda8a',
			  'ClientId' => '7055339',
			  'MissionNumber' => '9005657',
			  '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

[{"MissionId":"10013192","MissionNumber":"9012846","From":"COURSIER.FR","To":"LE BHV MARAIS","PickupStartDate":"2020-10-25 07:30:00","PickupEndDate":"2020-10-25 10:00:00","DeliveryStartDate":"2020-10-25 08:00:00","DeliveryEndDate":"2020-10-25 10:00:00"}]