Labels in 5 minutes

Ingredients:

  • apikey (provided by the team of Gsped)

  • name of the dedicated instance (provided by the team of Gsped)

  • client_id (provided by the team of Gsped)

You need to call the URL https://api.gsped.it/instancename/shipment with the POST method; the call body includes the palyload. The Content-type and Accept headers will have to be setted to application/json and the X-API-KEY header will have to be valued with the string given by the team Gsped.

Example of a payload: courier and services are to be specified with the amounts found in the page (Couriers and services)(overview/corrieri-e-servizi.md)

{
    "client_id": 390,
    "corriere": 101,
    "servizio": 0,
    "ddt_alpha": "rifmittente",
    "peso": 3.0,
    "colli": 1,
    "rcpt_name":"Mario Rossi",
    "rcpt_addr":"Piazza Castello 1",
    "rcpt_cap":"10121",
    "rcpt_city":"Torino",
    "rcpt_prov":"TO",
    "rcpt_country_code":"IT"
}

Check the status code on the response

400: the submitted data have not got through the prior check before the shipment creation. You can find the details in the field error

200: the submitted data have been accepted. A notification has been sent to the courier to proceed with the shipment. Verify the field status in the response.

The field status may take two different values:

Status 0.6: the courier did NOT accept the data and the shipment has not been created. The field error shows the error message returned by the courier (e.g. zip code and city do not match; service not available for that destination).

Each courier uses his own validation system for the addresses; therefore, adressess that are correct could be marked as incorrect due to some mistakes in the courier database.

An address found on Google Maps could possibly not be accepted by a courier

Status 0: the courier has accepted the data and the shipment has been generated. The arrays label-pdf, label-jpg e label-zpl will contain the labels to be applied on the parcels (jpg and pdf are base64-codified; the returned formats vary with the clientid and courier settings)

The field id, that can be found in the response, shows the unique identifier of the shipment given by Gsped. This number is essential for the shipment confirmation.

Last step

A call to the URL https://api.gsped.it/nomeistanza/shipmentConfirm should be finally made before entrusting the parcels to the courier, in order to send the shipments id and value the headers.

Example of payload for the shipmentConfirm

{
  "id": [
    "12345",
    "12346",
    "12347"
  ]
}

The confirmation is essential to the proper management of the shipment!

Last updated