API : create_return
Permet de créer un colis de type retour pour une commande donnée dans PMS.
La demande de création de l'étiquette de transport est facultative ("create_label": 1). Le contenu de l'étiquette PDF vous est retourné en base 64 dans la réponse. Le service de transport à utiliser doit dans ce cas être renseigné ("delivery_method_id"), il peut être trouvé dans PMS, dans Outils > Services de transport. Le service de transport doit être utilisable pour les retours.
Le détail des articles retournés est facultatif mais peut être obligatoire pour certains transporteur à l'international ou pour l'outre mer.
Exemple de requête
$json_request = "{...}";
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => "https://{account-name}.pms1.net/edi/api/create_return",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POSTREDIR => true,
CURLOPT_VERBOSE => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $json_request,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode('{account-name}:{password}')
)
));
$reply = curl_exec ($ch);
curl_close($ch);
$json = json_decode($reply);
Exemple de requête
{
"order_ref": "C486454",
"delivery_method_id": 2,
"delivery_email": "jeandurand@domaine.com",
"create_label": 1,
"products": [
{
"sku": "456465",
"quantity": 1,
"return_reason": "trop grand"
},
{
"sku": "878968",
"quantity": 1,
"return_reason": "trop grand"
}
]
}
Exemple de réponse
{
"order_id": 213140,
"order_ref": "212609",
"parcel": {
"parcel_id": 222195,
"is_return": 1,
"delivery_method_id": 2,
"ship_number": "8R46888684468",
"ship_weight": "1000",
"label_content": "DQoNCiVQREYtMS40CiXi48/TCjMgMCBvYmogPDwvTGVuZ3RoIDU1Nj4+c3RyZWFtCjAgSgowIGoKMC41NyB3CjAuMDAwIEcKMC4wMDAgZwpxIDEuMDAwMCAwIDAgMS4wMDAwIDAuMDAwMCAwLjAwMDAgY20KL1RQTDA1YTc2MWI4ZTVkOTBhNDljMWZmZjljNGEzYmNiOGE3ZmE4YWRiMWMgRG8gUQpCVCAvRjBhNzY3MDVkMThlMDQ5NGRkMjRjYjU3M2U1M2FhMGE4YzcxMGVjOTkgMTYuMDAgVGYgRVQKcSAxLjAwMCBnIEJUIDExMy4zOSAyNzguNjYgVGQgKEplIHJldG91cm5lIG1vbiBjb2xpcylUaiBFVCAxMTMuMzkgMjc3LjA2IDE1Mi45NCAtMC44MCByZSBmIFEKcSAxLjAwMCBnIEJUIDU3OCU5NCAwMDAwMCBuIAowMDAwMTYzMzA0IDAwMDAwIG4gCjAwMDAxNjQ3MjAgMDAwMDAgbiAKMDAwMDE2ODIyNyAwMDAwMCBuIAowMDAwMTY4MjczIDAwMDAwIG4gCnRyYWlsZXIKPDwvSW5mbyAzOSAwIFIvSUQgWzxmOWYxOTY5NmM4ODYzMzBiZGVhMTg4N2E3YzJjNjg4Nj48MGI3NzI1NWM5ZjYxZDAwMTA4MzdjMzk0OTY4NTdiZVPRgoNCg==",
"customs_content": null
}
}
Exemple d'erreur
{
"error": "'order_ref' non renseigné"
}