Shipment

Shipment management

Shipment - GET

This endpoint allows to manage the creation, the data retrieval and the cancellation of any shipment on Gsped.

Shipment -GET

GET https://api.gsped.it/[INSTANCE]/Shipment

Retrieves all the information about a shipment, including the labels.

Query Parameters

Name
Type
Description

id*

String

Unique ID of the shipment

Headers

Name
Type
Description

x-api-key*

String

Apikey given by Gsped

{
    // Response
}

Example Snippets

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.gsped.it/sandbox/Shipment?id=70059765",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "x-api-key: YOUR-API-KEY"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Shipment - POST

The Shipment Post call allows to create the shipment.

If the operation is successful, it returns the shipment data together with their labels in all the available formats.

The shipment creation is not always successful; both Gsped and the courier's systems perform a series of checks on the data received. All the possible errors must be properly managed.

To check the outcome of the calls, follow these steps:​ ​

Check the response of the API on the shipment creation POST. There are two possible HTTP responses:

400: The data failed to pass the first series of controls. The type of problem is displayed in the field error (e.g. a required field is missing).

200: the data have been validated and the waybill generation has been started. At this point, the value of the field status must be checked; if it displays the value 0 the waybill has correctly been generated and could be downloaded from the right section. If the status field displays the value 0.6 the generation of the waybill has failed and the field error shows the occurred type of problem (eg. inconsistent zip code and city, address not accepted by the courier's systems, service not available for the destination, etc. )

Shipment POST

POST https://api.gsped.it/[INSTANCE]/Shipment

Shipment creation

Headers

Name
Type
Description

x-api-key*

String

Apikey given by Gsped

Request Body

Name
Type
Description

corriere*

Int

Gsped courier ID

Couriers and services

)

servizio*

Int

Gsped service ID

Couriers and services

)

client_id*

Int

Client ID given by Gsped

ddt_alpha

String

Alphanumeric reference of the shipment. If not defined, Gsped creates one automatically

ddt_num

String

Numeric reference of the shipment. If not defined, Gsped creates one automatically

merce*

String

Generic description of the shipped goods

origine*

String

Iso 2 char of the Provenience of the goods (nation)

contrassegno

Float

COD amount

tipo_incasso

Int

ID type of payment:see - ->

valuta

Iso 4217 currency symbol

valore

Float

Assurance amount

peso*

Float

Weight of the shipment (KG)

volume*

Float

Volume of the shipment (cu m)

colli*

Int

Number of parcels

daticolli

Array

Size of the parcels

daticolli.altezza

Int

Height of the single parcels in cm

daticolli.larghezza

Int

Width of the single parcels in cm

daticolli.lunghezza

Int

Height of the single parcels in cm

daticolli.peso

Float

Weight of the single parcel (KG)

daticolli.volume

Float

Volume of the single parcels (cu m)

sender_name

String

Name of the sender

sender_contact

String

Contact name of the sender

sender_addr

String

Address of the sender

sender_city

String

CIty of the sender

sender_cap

String

Zipcode of the sender

sender_prov

String

Province/country of the sender (iso 2 char)

sender_country_code

String

Country of the sender (iso 2 char)

sender_phone

String

Phone number of the sender

sender_email

String

Email of the sender

rcpt_name*

String

Name of the recipient

rcpt_contact*

String

Contact name of the recipient

rcpt_addr*

String

Address of the recipient

rcpt_city*

String

City of the recipient

rcpt_cap*

String

Zipcode of the recipient

rcpt_prov*

String

Province/country of the recipient (iso 2 char)

rcpt_country_code*

String

Country of the recipient (iso 2 char)

rcpt_phone*

String

Phone number of the recipient

rcpt_email*

String

Email of the recipient

addebito_dogana

Int

Custom charges.

Admitted values :

  • 0 : Custom charges billed to the recipient

  • 1 : Custom charges billed to the sender

  • 2 : Custom charges billed to a third party

note_sender

String

Name of the sender

trade_documents

Array

Electronic documents (PLT) for the entitled couriers

PLT-licensed couriers (paperless)

trade_documents.nome

String

Name of the document

trade_documents.contenuto

String

Base 64 string of the document

dettagli_ordine

Array

Data of the order

dettagli_ordine.sku

String

SKU of the single item

dettagli_ordine.descripion

String

Description of the single item

dettagli_ordine.qty

Int

Amount of the single item

dettagli_ordine.barcode

String

Barcode string of the single item

dettagli_ordine.hs_code

String

HS/TARIC code of the single item

dettagli_ordine.prezzo_singolo

String

Price of the single item

dettagli_ordine.peso_riga

String

Peso singolo item - Weight of the single item

dettagli_ordine.country_of_origin

String

Provenience of the good

date_req_ritiro

String

Pick-up date (YYYY-MM-DD)

opening_time

String

Opening time for the pickup (HH:MM:SS )

closing_time

String

Closing time for the pickup (HH:MM:SS)

dropshipping

String

0|1 flag to identify a shipment in dropshipping

al_piano

String

S|N flag to activate the delivery to the floor (only for enabled couriers)

al_sabato

String

S|N flag to activate the saturday delivery service (only for enabled couriers)

reso_contestuale

String

S|N flag to activate the EXCHANGE service (only for enabled couriers)

fermo_deposito

String

S|N flag to identify a shipment in custody

generic_service_point

String

Service point ID of the couriers

documenti

String

0|1 flag to identify a document shipment

valore_doganale

Float

Customs value

opening_time2

String

Second goods ready time (HH:MM:SS) - only for TNT

closing_time2

String

Second closing time (HH:MM:SS) - only for TNT

invoice_date

String

Format YYYY-MM-DD of the invoice date

invoice_number

String

Invoice number

dettagli_ordine.qty*

String

As above but required to:

-- DHL ICS2

dettagli_ordine.um

String

Unit of measurement for the order row:

-- BOX (boxes)

-- KG (chilograms)

-- L (liters)

-- M (meters)

-- NO (number)

-- PCS (pieces)

dettagli_ordine.um*

String

As above but required to:

-- DHL ICS2

dettagli_ordine.descripion*

String

As above but required to:

-- DHL ICS2

dettagli_ordine.country_of_origin*

String

As above but required to:

-- DHL ICS2

dettagli_ordine.peso_riga*

String

As above but required to:

-- DHL ICS2

dettagli_ordine.prezzo_singolo*

String

As above but required to:

-- DHL ICS2

{
  "client_id": 390,
  "cod_destinatario": "",
  "colli": 1,
  "contrassegno": 0,
  "corriere": 104,
  "date_req_cons": "0000-00-00 00:00:00",
  "ddt_alpha": "TEST_GSPED",
  "ddt_num": 12346,
  "merce": "",
  "note_sender": "",
  "origine": "IT",
  "peso": 1.8,
  "preavviso_telefonico": "",
  "rcpt_addr": "115 E Endfield Rd",
  "rcpt_cap": 19053,
  "rcpt_city": "Feasterville Trevose",
  "rcpt_contact": "Tester",
  "rcpt_country_code": "US",
  "rcpt_email": "test@test.edu",
  "rcpt_name": "TEST MITTENTE",
  "rcpt_phone": "123456789",
  "rcpt_prov": "PA",
  "servizio": 9,
  "tipo_incasso": 0,
  "valore": 0,
  "valore_doganale": 37.5,
  "volume": 0.029,
  "status": 0,
  "fid_partenza": "",
  "num_serie": 0,
  "num_spedizione": "1253863656",
  "date_upd": "0000-00-00 00:00:00",
  "error": "",
  "sender_name": "test mittente",
  "sender_addr": "p.za Ambrosoli 13",
  "sender_cap": 15121,
  "sender_city": "Alessandria",
  "sender_contact": "Rossi Pino",
  "sender_prov": "AL",
  "sender_country_code": "IT",
  "sender_email": "test@test.it",
  "label_jpg": [
    "base64 encoded label string"
  ],
  "label_pdf": [
    "base64 encoded label string"
  ],
  "label_zpl": [
    "ZPL label string"
  ],
  "id": 50003621,
  "tnt_options": [],
  "tracking_link": "",
  "valuta": "EUR",
  "dropshipping": 0,
  "sender_phone": 12345562,
  "al_piano": "",
  "al_sabato": "",
  "reso_contestuale": "",
  "fermo_deposito": 0,
  "note": "",
  "centro_costo": "",
  "sda_servizio": "",
  "user_id": 0,
  "opening_time": "00:00:00",
  "closing_time": "00:00:00",
  "date_req_ritiro": "0000-00-00 00:00:00",
  "ups_uap_id": "",
  "sda_id_fermoposta": "",
  "note_2": "",
  "confermato": 0,
  "ups_signature_required": 0,
  "id_pickup": null,
  "documenti": 0,
  "sda_accessori": 0,
  "packaging": "",
  "dropoff_type": "",
  "vat_seller": "",
  "vat_buyer": "",
  "generic_service_point": "",
  "tipo_transazione": "supSoglia",
  "rcpt_language": "",
  "sender_eori": "",
  "rcpt_eori": "",
  "link_pickup_booking": ""
}

Example Snippets

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.gsped.it/sandbox/shipment",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n  \"client_id\": 390,\n  \"colli\": 2,\n  \"contrassegno\": 0,\n  \"corriere\": 104,\n  \"ddt_alpha\": \"TEST_GSPED\",\n  \"ddt_num\": 12346,\n  \"origine\": \"IT\",\n\t\"dropshipping\" : 0,\n  \"peso\": 2.4,\n  \"rcpt_addr\": \"115 E Endfield Rd\",\n  \"rcpt_cap\": \"19053\",\n  \"rcpt_city\": \"Feasterville Trevose\",\n  \"rcpt_contact\": \"Tester\",\n  \"rcpt_country_code\": \"US\",\n  \"rcpt_email\": \"test@test.it\",\n  \"rcpt_name\": \"TEST DESTINATARIO\",\n  \"rcpt_phone\": \"2159005458\",\n  \"rcpt_prov\": \"PA\",\n  \"servizio\": 9,\n  \"valore\": 0,\n  \"valore_doganale\": 37.50,\n  \"valuta\": \"EUR\",\n  \"volume\": 0.0972,\n\t\"daticolli\": [\n    {\n      \"altezza\": 39,\n      \"larghezza\": 29,\n      \"lunghezza\": 43,\n      \"volume\": 0.048633,\n      \"peso\": 1.2\n    },\n\t\t{\n      \"altezza\": 39,\n      \"larghezza\": 29,\n      \"lunghezza\": 43,\n      \"volume\": 0.048633,\n      \"peso\": 1.2\n    }\n  ],\n  \"dettagli_ordine\" : [\n    {\n      \"sku\" : \"PBK1\",\n      \"description\": \"Cosa blu\",\n      \"qty\": \"1\",\n      \"barcode_riga\": \"12345464\",\n      \"hs_code\": \"123456454\",\n      \"prezzo_singolo\": \"12.50\",\n      \"peso_riga\": \"1\"\n    },{\n      \"sku\" : \"PBK12\",\n      \"description\": \"Cosa blu e rossa\",\n      \"qty\": \"1\",\n      \"barcode_riga\": \"12345465\",\n      \"hs_code\": \"123456454\",\n      \"prezzo_singolo\": \"25.00\",\n      \"peso_riga\": \"1\"\n    }\n  ]\n}",
  CURLOPT_HTTPHEADER => [
    "x-api-key: YOUR-API-KEY"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Shipment - DELETE

This endpoint allows to delete the shipments just in case they have not already been confirmed

When a shipment is cancelled the labels returned by the POST are no longer valid and must be deleted.

Shipment DELETE

DELETE https://api.gsped.it/[INSTANCE]/Shipment

Cancellation of a shipment from the systems of Gsped and of the couriers

Query Parameters

Name
Type
Description

id*

String

Unique ID of the shipment

Headers

Name
Type
Description

x-api-key*

String

Apikey given by Gsped

{
  "error": ""
}

Example Snippets

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "http://api.gsped.it/sandbox/Shipment?id=53",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "x-api-key: YOUR-API-KEY"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Last updated