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

Headers

{
    // 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

Request Body

{
  "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

Headers

{
  "error": ""
}

Example Snippets

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "http://apistaging.aws.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