Webhook Ver. 1.2

rel. 1.2.34
Qapla' srl   •   06492420481

Introduction

Webhook is a notification of an event published in a URL of your choice.

Webhooks are useful for integration with third-party services and other external APIs that support them.

Qapla' webhook is part of the API of Qapla'.

API Key

In order to use the APIs it is necessary to be aware of the Private API Keys assigned to your channel(s), which are located on the Control Panel in section "Settings \ [CHANNEL_NAME]"

This API key must be protected and kept secret.

API Key

Security

The IP addresses from which it will be possible to receive the POST of the webhook are:

Shipments webhook

Each change of shipment status communicated by the courier (ex: if the shipment changes from "delivery" to "delivered"), a POST in JSON format is sent to the URL indicated in the channel configuration on the Qapla' control panel.
POSThttps://[YOUR_ENDPOINT]
HTTP POST
In a POST at the endpoint indicated in the channel configuration Qapla' Control Panel, like:
POST / HTTP/1.1
Content-Type: application/json;
Content-Length: 1232
Host: webhook.qapla.it
Connection: Keep-Alive
User-Agent: Mozilla/5.0
it will be sent the following communication:


    "statusDetails" will be sent if necessary as follows. For example, note the "STOCK" status detail, referring to the "EXCEPTION" status.

    


    
Description
Following the description of the individual parameters.
Parameter Description
apiKey(string) The API Key of the channel from which we are receiving the notification.
trackingNumber(string) The tracking number of the shipment
return(int) It is 1 if it is a return shipment
hasChildren(int) It is 1 if the shipment has "child" shipments
isChild(int) It is 1 if the shipment is a "child" shipment
courier(string) The Qapla' courier code
reference(string) Order's alphanumeric reference
date(string) The status date, as reported by the courier
courierStatus(string) The status communicated by the courier
place(string) The place communicated by the courier
qaplaStatusID(string) The "translation" of the status of the courier in the Qapla' status
qaplaStatus Status description
statusDetails The ID of possible detail
custom1 Possible custom1 value of the shipment
custom2 Possible custom2 value of the shipment
custom3 Possible custom3 value of the shipment
Response
The response from URL called must be:
{"result": "OK"}
Only in case of error will be:
{"result": "KO"}
Retry

The result "KO" or any other type of wrong answer that is not "OK" will force the webhook to retry the transmission 2 more times in the following hours.

Abuse

After 100 failed transmission attempts (i.e. with "KO" response or non-compliant response) the service will be disabled.

Enpoint example
POSThttps://[YOUR_URL]/qaplaWebhook.php
The following example of a "listening" page takes the JSON content and processes it.
<?php
//...I set the content-type as JSON
header('Content-type: application/json; charset=utf-8');

//...API Key that I expect
const API_KEY = '[API_KEY]';

//...I obtain the string sent as a POST
$data = file_get_contents('php://input');

//...If it is empty I get very angry
if(empty($data)):
    exit('{"result": "KO"}');
endif;

//...I turn it in a JSON
$json = json_decode($data);

//...If it's an incorrect JSON, I get even more angry
if(($json === false))
    exit('{"result": "KO"}');
endif;

//...I verify that the API KEY posted matches, security check.
if($json->apiKey !== API_KEY):
    exit('{"result": "KO"}');
endif;

//...I update the potential table
$sql = "UPDATE orders-shipments SET status = ".$json->qaplaStatusID." WHERE id = ".$json->reference;

//...Everything right, I write "result": "OK" in JSON
echo '{"result": "OK"}';
?>
Test

Test your endpoint and send a typical Qapla' transmission.

API Key*
URL*
Tracking Number*
Courier*
Reference*
Courier Status*
Place*
Qapla' Status

Shipments return webhook

Each return request from the end customer * will be sent to an endpoint defined on the Qapla 'Control Panel , details of the return shipment.
POSThttps://[YOUR_ENDPOINT]
*This service is only available after enabling, configuring and purchasing the Automatic Returns (Type 3 Returns) service on the Qapla 'Store.
HTTP POST
Below is a detailed example of the POST
POST / HTTP/1.1
Content-Type: application/json;
Content-Length: 1232
Host: webhook.qapla.it
Connection: Keep-Alive
User-Agent: Mozilla/5.0

    
Description
Below is the description of the individual parameters.
Parameter Description
apiKey(string) The API Key of the channel from which we are receiving the notification.
returnShipments(object[])
Parameter Description
date(string) Return creation date
reference(string) Order reference
RMA(string) Return Merchandise Authorization Code
parcels(integer) Parcels
weight(float) Weight
trackingNumber(string) The tracking number of the return shipment
courier(object)
Parameter Description
code(string) Code
name(string) Name
icon(string) Link to icon
sender(object) He is the sender of the shipment if different from the contract holder.
Parameter Description
name(string) Sender's name
address(string) Sender's address
city(string) City of the sender
state(string) Province
postCode(string) Post Code
country(string) Country in ISO 3166-1 alpha-2 format (Example: IT)
email(string) Sender's email
telephone(string) Sender's phone
consignee(object) It is the recipient of the Return shipment.
Parameter Description
name(string) Name / Company name
address(string) Address
city(string) City
state(string) Province
postCode(string) Postal code
country(string) Country in ISO 3166-1 alpha-2 format (Example: IT)
rows(array of objects) List of items in return
Parameter Description
sku(string) SKU
name(string) Item name
qty(string) Quantity
total(string) Total item cost
reason(string) Reason for returning the item
Response
The response of the URL named should be :
{"result": "OK"}
While only in case of error will it be:
{"result": "KO"}
Retry

The result "KO" or any other type of incorrect response other than "OK" will force the webhook to retry the transmission 2 more times in the following hours.

Abuse

After 100 failed transmission attempts (ie with "KO" or non-compliant response) the service will be deactivated.

Orders webhook

Webhook can be configured to be sent when the shipment is created (label printing) or sent (sending confirmation to the courier), in the appropriate section on Control Panel of Qapla'.
POSThttps://[YOUR_ENDPOINT]
HTTP POST
In a POST at the endpoint indicated in the channel configuration on Qapla' Control Panel, like:
POST / HTTP/1.1
Content-Type: application/json;
Content-Length: 1232
Host: webhook.qapla.it
Connection: Keep-Alive
User-Agent: Mozilla/5.0
it will be sent the following communication:


    
Description
apiKey(string) The API Key of the channel from which we are receiving the notification.
orders(array) It is an array of orders.
reference(string) Order reference
orderDate Order date
shipDate Order creation date
courier The Qapla' courier code
trackingNumber The tracking number of the shipment
return(bool) It is true if the shipment has a return
returnTrackingNumber(string) Possible tracking number of return shipment
weight(float) Weight
parcels(int) Packages
length(float) Length
width(float) Width
height(float) Height
amount(string) Shipment cost
isPOD(bool) It is true if the shipment is cash on delivery
customerName(string) Recipient name
customerAddress(string) Recipient address
customerCity(string) Recipient City
customerState(string) Recipient province
customerZip(string) Recipient postal code
customerCountry(string) Recipient country
customerTelephone(string) Recipient telephone
customerEmail(string) Recipient email
notes(string) Any order notes
Test

Test your endpoint and send a typical Qapla' transmission.

API Key*
URL*
Reference*
Order date
Ship date
Tracking Number
Courier
Weight
Parcels
Length
Width
Height
Amount
Is POD
Customer Name
Customer Address
Customer City
Customer State
Customer Zip
Customer Country
Customer Telephone
Customer Email
Notes

Qapla' Status

It is the interpretation of the status of the shipment with values that Qapla' assigns to each possible state of the courier.

iddetailIDNameDescription
0 PROCESSING WAIT
1 PENDING Shipment found but any news yet from courier.
2 WAITING FOR PICK-UP The courier didn’t pick up the shipment yet.
20 DEPARTED Shipment departed.
3 IN TRANSIT The goods are in transit.
50 PROCESSING Processing
50 1 PROCESSING • CUSTOMS
4 OUT FOR DELIVERY Shipment in delivery.
5 FAILED DELIVERY ATTEMPT Delivery failed. Early warning for potential problems.
8 DELAY Shipment is suffering delay.
6 EXCEPTION There is a problem; generic or explained by additional icons.
6 1 EXCEPTION • STOCK
6 2 EXCEPTION • RETURN
6 3 EXCEPTION • DAMAGED
6 4 EXCEPTION • LOST
6 5 EXCEPTION • PARTIAL DELIVERY
10 PICKUP POINT Delivered to a PickUp Point.
95 RETURNED Shipment returned to sender.
99 DELIVERED The shipment has been delivered to the recipient.

Couriers

List of Qapla's couriers' codes, in alphabetical order.
CodeNameURL
FOURPX FOURPX 4PX http://express.4px.com/ CN
AG-LOGISTICA AG-LOGISTICA AG Logistica http://www.aglogisticasrl.it/ IT
AIR-EXPRESS-IT AIR-EXPRESS-IT Air Express https://airexpress.it/ IT
ALIEXPRESS ALIEXPRESS Aliexpress https://www.aliexpress.com/‎ CN
ALPI ALPI Alpi World https://www.alpiworld.com/ GLOBAL
AMATI-JR AMATI-JR Amati JR http://www.amatijrtrasporti.it/ IT
AMAZON-SHIPPING AMAZON-SHIPPING Amazon Shipping https://shipping.amazon.co.uk/ IT
AN-POST AN-POST An Post https://www.anpost.com/ IE
APP2DELIVERY APP2DELIVERY App2delivery IT
ARAMEX ARAMEX Aramex http://www.aramex.com GLOBAL
ARCO ARCO Arco Spedizioni http://www.arco.it/ IT
ASENDIA ASENDIA Asendia Europe https://www.asendia.com EU
ASENDIA-DE ASENDIA-DE ASENDIA Germany http://www.asendia.de/ DE
ASENDIA-USA ASENDIA-USA ASENDIA USA http://www.asendiausa.com/ US
ASM ASM ASM http://www.asmred.com ES
AUSTRALIA-POST AUSTRALIA-POST Australia Post https://auspost.com.au/ AU
AUSTRIAN-POST AUSTRIAN-POST Austrian Post https://www.post.at AT
BETSERVICE BETSERVICE B&T Service http://www.betservice.net/ IT
BELPOCHTA BELPOCHTA Belpochta https://belpost.by/ BY
BIZ-COURIER BIZ-COURIER Biz Courier https://www.bizcourier.eu/ GR
BPOST BPOST BPost https://track.bpost.be BE
BRACCHI BRACCHI Bracchi https://www.bracchi.it/ IT
BRAZIL-CORREIOS BRAZIL-CORREIOS Brazil Correios http://correios.com.br/ BR
BRT BRT BRT http://www.brt.it IT
BULGARIAN-POSTS BULGARIAN-POSTS Bulgarian Posts https://www.bgpost.bg/en BG
CBL-LOGISTICA CBL-LOGISTICA CBL Logistica http://www.cbl-logistica.com ES
CELERITAS CELERITAS Celeritas https://celeritastransporte.com/ ES
CZECH-POST CZECH-POST Česká pošta https://www.ceskaposta.cz CZ
CEVA-LOGISTICS CEVA-LOGISTICS Ceva Logistics https://www.cevalogistics.com/ GLOBAL
CHINA-EMS CHINA-EMS China EMS http://www.11183.com.cn/english.html CN
CHINA-POST CHINA-POST China Post http://www.chinapost.com.cn/ CN
CHRONOPOST-FR CHRONOPOST-FR Chronopost France http://www.chronopost.fr/ FR
CNE-EXPRESS CNE-EXPRESS CNE Express http://www.cnexps.com/ CN
COLDLINE COLDLINE Coldline https://www.coldlinegroup.com/ IT
COLIS-PRIVE COLIS-PRIVE Colis Privé https://www.colisprive.com FR
COLISSIMO COLISSIMO Colissimo http://www.colissimo.fr FR
CORREOS CORREOS Correos http://www.correos.es ES
CORREOS-EXPRESS CORREOS-EXPRESS Correos Express https://www.correosexpress.com ES
COURIER-EXPRESS-IT COURIER-EXPRESS-IT Courier expres http://www.spacecomputer-web.it/web/courier IT
CRONO-PTI CRONO-PTI Crono Poste http://www.poste-impresa.it/online/pmi/postali/italia/crono-gamma.shtml IT
CRONO-REVERSE CRONO-REVERSE Crono Reverse https://business.poste.it/professionisti-imprese/prodotti/crono-reverse-gestione-resi-ecommerce.html IT
CTS_GROUP CTS_GROUP CTS GROUP https://www.ctsgroup.nl/en/ NL
CTT CTT CTT https://www.ctt.pt PT
CYPRUS-POST CYPRUS-POST Cyprus Post https://www.cypruspost.post/ CY
DAC-IT DAC-IT D.A.C https://dac-it.com/ IT
DBSCHENKER DBSCHENKER DB Schenker https://www.dbschenker.com/ GLOBAL
DEUTSCHE-POST DEUTSCHE-POST Deutsche Post https://www.deutschepost.de/ DE
DHL-DE DHL-DE Deutsche Post DHL http://www.dpdhl.com/ DE
DHL-ECOMMERCE DHL-ECOMMERCE DHL eCommerce http://webtrack.dhlglobalmail.com/ US
DHL DHL DHL Express http://www.dhl.com/ GLOBAL
DHL-FREIGHT DHL-FREIGHT DHL Freight https://www.logistics.dhl GLOBAL
DHL-PAKET DHL-PAKET DHL Paket https://www.dhl.de/ DE
DHLPARCEL-CONNECT DHLPARCEL-CONNECT DHL Parcel Connect http://www.dhl.com/ EU
DHLPARCEL-NL DHLPARCEL-NL DHL Parcel NL https://www.dhlparcel.nl/ NL
DHLPARCEL-ES DHLPARCEL-ES DHL Parcel Spain https://www.dhlparcel.es ES
DMM DMM DMM Network http://www.dmmnetwork.it/ IT
DPD DPD DPD http://www.dpd.com/ GLOBAL
DPD-FR DPD-FR DPD France http://www.dpd.fr FR
DPD-UK DPD-UK DPD UK http://www.dpd.co.uk/ GB
DSV DSV DSV http://www.dsv.com/ GLOBAL
ELTA-HELLENIC-POST ELTA-HELLENIC-POST ELTA Hellenic Post https://www.elta.gr GR
EMIRATES-POST EMIRATES-POST Emirates Post https://www.epg.gov.ae/ AE
ENERGO-LOGISTIC ENERGO-LOGISTIC Energo Logistic https://www.energologistic.it/ IT
ENVIALIA ENVIALIA Envialia http://www.envialia.com/ ES
FAST-WL FAST-WL FAST WORLD LOGISTIC http://www.fastwl.com/ FR
FEDEX FEDEX FedEx http://www.fedex.com/ GLOBAL
FERCAM FERCAM FERCAM Logistics http://www.fercam.com/ IT
FERMOPOINT FERMOPOINT Fermopoint https://www.fermopoint.it IT
FINESSO FINESSO Finesso https://www.finesso.it/ IT
GEODIS GEODIS Geodis https://geodis.com/ FR
GLOBALTR GLOBALTR Global Trasporti http://www.globaltrasporti.com/ IT
GLS-ITA GLS-ITA GLS http://www.gls-italy.com IT
GLS GLS GLS Europe https://gls-group.eu/ EU
GLS-EUROPE-WW GLS-EUROPE-WW GLS Europe WW https://gls-group.eu/GROUP/en/home GLOBAL
GLS-FR GLS-FR GLS France https://gls-group.eu/FR/fr/home FR
GLS-SPAIN GLS-SPAIN GLS Spain https://m.gls-spain.es/ ES
GO-EXPRESS GO-EXPRESS GO! Express & Logistics https://www.general-overnight.com DE
HERMES-DE HERMES-DE Hermes Germany https://www.myhermes.de DE
HERMES-IT HERMES-IT Hermes Italy http://www.hermes-italy.it/ IT
HERMES HERMES Hermes UK https://www.myhermes.co.uk GB
HONG-KONG-POST HONG-KONG-POST Hong Kong Post https://www.hongkongpost.hk/en/home/index.html HK
HRP HRP HR Parcel https://www.hrparcel.com/ IT
HRVATSKA-POSTA HRVATSKA-POSTA Hrvatska pošta https://www.posta.hr HR
INPOST INPOST InPost https://inpost.it/ IT
INSTALLO INSTALLO Installo https://www.installo.it/ IT
INTEGRA2 INTEGRA2 Integra2 https://www.integra2.es/ ES
JERSEY-POST JERSEY-POST Jersey Post https://www.jerseypost.com/ GB
KOREA-POST KOREA-POST Korea Post https://www.epost.go.kr KR
LA-POSTE LA-POSTE La Poste https://www.laposte.fr/ FR
LATVIJAS-PASTS LATVIJAS-PASTS Latvijas Pasts https://pasts.lv/ LV
LICCARDI LICCARDI Liccardi Trasporti https://www.liccarditrasporti.com/ IT
LIETUVOS-PASTAS LIETUVOS-PASTAS Lietuvos Paštas https://www.post.lt/ LT
LUXEMBOURG-POST LUXEMBOURG-POST Luxembourg Post https://www.post.lu LU
MAGYAR-POSTA MAGYAR-POSTA Magyar Posta https://www.posta.hu/ HU
MBE-IT MBE-IT Mail Boxes Etc. Italia https://www.mbe.it/ IT
MALTA-POST MALTA-POST Malta Post https://www.maltapost.com/ MT
MILKMAN MILKMAN Mlk Fresh Refrigerato https://www.milkman.it/ IT
MONDIALRELAY MONDIALRELAY Mondial Relay https://www.mondialrelay.fr FR
MRW-ES MRW-ES MRW http://www.mrw.es/ ES
NACEX-ES NACEX-ES Nacex https://www.nacex.es/ ES
NEXIVE NEXIVE Nexive http://www.nexive.it/ IT
NOPAR NOPAR Nopar Solutions http://noparsolutions.com/ ES
OMNIVA OMNIVA Omniva https://www.omniva.ee EE
ONEXP ONEXP One Express http://www.oneexpress.it IT
ONTRAC ONTRAC OnTrac http://www.ontrac.com GLOBAL
PAACK PAACK Paack GLOBAL
PACKETA PACKETA Packeta https://tracking.packeta.com/ GLOBAL
PALLETW PALLETW Palletways http://www.palletways.com EU
PALLEX PALLEX Pallex https://www.pallex.it/ IT
PARCEL-FORCE PARCEL-FORCE Parcel Force http://www.parcelforce.com GB
POCZTA-POLSKA POCZTA-POLSKA Poczta Polska http://www.poczta-polska.pl PL
PONYU PONYU PonyU GLOBAL
POS-MALAYSIA POS-MALAYSIA Pos Malaysia https://www.pos.com.my/ MY
POSTA-ROMANA POSTA-ROMANA Poșta Română https://www.posta-romana.ro/ RO
SLOVENIA-POST SLOVENIA-POST Pošta Slovenije https://www.posta.si SI
PTI PTI Poste Italiane http://www.poste.it IT
POSTEN-NORGE POSTEN-NORGE Posten Norge https://www.posten.no/ NO
POSTI POSTI Posti https://www.posti.fi/ FI
POSTNL-INT POSTNL-INT PostNL International http://www.postnl.post/ NL
POSTNL-3S POSTNL-3S PostNL International 3S https://www.internationalparceltracking.com NL
POSTNORD-DENMARK POSTNORD-DENMARK PostNord Denmark https://www.postnord.dk DK
POSTNORD-SWEDEN POSTNORD-SWEDEN PostNord Sweden https://www.postnord.se/ SE
QHD QHD QHD https://www.qhditalia.it/ GLOBAL
RDA RDA Ramoneda http://www.ramoneda.com/ ES
REDUR REDUR Redur ES
ROYAL-MAIL ROYAL-MAIL Royal Mail http://www.royalmail.com GB
RPOST RPOST RPost https://www.errepost.it/ IT
RUSSIAN-POST RUSSIAN-POST Russian Post https://www.pochta.ru RU
SF-EXPRESS SF-EXPRESS S.F. Express http://www.sf-express.com CN
SAILPOST SAILPOST Sailpost http://www.sailpost.it IT
SMM-IT SMM-IT San Marino Mail http://www.sanmarinomail.sm IT
SDA SDA SDA http://wwww.sda.it IT
SDA-RACCOMANDATA SDA-RACCOMANDATA SDA Raccomandata http://wwww.sda.it IT
SENDABOX SENDABOX Sendabox http://www.sendabox.it IT
SENDING SENDING Sending Transporte Urgente https://www.sending.es ES
SEUR SEUR Seur http://www.seur.com ES
SGT SGT SGT Corriere Espresso http://www.sgt.it/ IT
SINOTRANS SINOTRANS Sinotrans http://www.sinotrans-csc.com/ CN
SKYNET-ITA SKYNET-ITA SkyNet Italy http://www.skynetitaly.it IT
SKYNET SKYNET SkyNet Worldwide Express http://www.skynetwwe.com/ GLOBAL
SOUTH-AFRICAN-POST SOUTH-AFRICAN-POST South African Post https://www.postoffice.co.za ZA
SPEDIAMO SPEDIAMO Spediamo.it http://www.spediamo.it/ IT
SPRING-GDS SPRING-GDS Spring GDS https://www.spring-gds.com/ EU
STEF-IT STEF-IT STEF https://www.stef.it/ IT
SUSA SUSA Susa https://flex.susa.it/Home IT
SWISS-POST SWISS-POST Swiss Post https://www.post.ch/ CH
TWS TWS T.W.S. Express Courier http://www.twsexpresscourier.it IT
TECNO-TRANS TECNO-TRANS Tecnotrans http://www.tecnotrans.eu IT
TEMPO-ONE TEMPO-ONE Tempo One https://www.tempo-one.com/ FR
TIPSA TIPSA TIPSA http://www.tip-sa.com/ ES
TNT TNT TNT http://www.tnt.com GLOBAL
TNT-CLICK TNT-CLICK TNT Click http://www.tnt-click.it IT
TNT-ES TNT-ES TNT España http://www.tnt.es ES
TNT-ITA TNT-ITA TNT Italia https://www.tnt.it/ IT
TNT-UK TNT-UK TNT UK http://www.tnt.com/express/en_gb/site/home.html GB
TOLL TOLL Toll Group https://www.tollgroup.com/ GLOBAL
TOURLINE-EXPRESS TOURLINE-EXPRESS Tourline Express http://www.tourlineexpress.com ES
TRAKPAK TRAKPAK Trakpak http://www.trackmytrakpak.com EU
TYP TYP TYP https://typ.delivery IT
UPS UPS UPS http://www.ups.com/ GLOBAL
USPS USPS USPS https://www.usps.com/ US
YAMATO YAMATO Yamato Transport GLOBAL
YANWEN YANWEN Yanwen http://www.yw56.com.cn/ CN
YDH YDH Ydh http://www.ydhex.com/ CN
YODEL YODEL Yodel Domestic http://www.yodel.co.uk/ GB
YUNEXPRESS YUNEXPRESS Yun Express http://www.yunexpress.com/ CN
ZELERIS-ES ZELERIS-ES Zeleris https://www.zeleris.com/ ES
ZUST ZUST Züst Ambrosetti http://www.zust.it/ IT