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
}
{
// Response
}
{
// Response
}
{
// 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;
}
import http.client
conn = http.client.HTTPSConnection("api.gsped.it")
payload = ""
headers = { 'x-api-key': "YOUR-API-KEY" }
conn.request("GET", "/sandbox/Shipment?id=70059765", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.gsped.it/sandbox/Shipment?id=70059765"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "YOUR-API-KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
// Some codevar client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.gsped.it/sandbox/Shipment?id=70059765"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
curl --request GET \
--url 'https://api.gsped.it/sandbox/Shipment?id=70059765' \
--header 'x-api-key: YOUR-API-KEY'
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": ""
}
{
"error": "client_id: deve essere lungo al massimo 7 caratteri"
}
{
"status": false,
"error": "Invalid API key "
}
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;
}
import http.client
conn = http.client.HTTPSConnection("api.gsped.it")
payload = json.dumps({
"client_id": 390,
"colli": 2,
"contrassegno": 0,
"corriere": 104,
"ddt_alpha": "TEST_GSPED",
"ddt_num": 12346,
"origine": "IT",
"dropshipping": 0,
"peso": 2.4,
"rcpt_addr": "115 E Endfield Rd",
"rcpt_cap": "19053",
"rcpt_city": "Feasterville Trevose",
"rcpt_contact": "Tester",
"rcpt_country_code": "US",
"rcpt_email": "test@test.it",
"rcpt_name": "TEST DESTINATARIO",
"rcpt_phone": "2159005458",
"rcpt_prov": "PA",
"servizio": 9,
"valore": 0,
"valore_doganale": 37.50,
"valuta": "EUR",
"volume": 0.0972,
"daticolli": [
{
"altezza": 39,
"larghezza": 29,
"lunghezza": 43,
"volume": 0.048633,
"peso": 1.2
},
{
"altezza": 39,
"larghezza": 29,
"lunghezza": 43,
"volume": 0.048633,
"peso": 1.2
}
],
"dettagli_ordine": [
{
"sku": "PBK1",
"description": "Cosa blu",
"qty": "1",
"barcode_riga": "12345464",
"hs_code": "123456454",
"prezzo_singolo": "12.50",
"peso_riga": "1"
},
{
"sku": "PBK12",
"description": "Cosa blu e rossa",
"qty": "1",
"barcode_riga": "12345465",
"hs_code": "123456454",
"prezzo_singolo": "25.00",
"peso_riga": "1"
}
]
})
headers = { 'x-api-key': "YOUR-API-KEY" }
conn.request("POST", "/sandbox/shipment", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.gsped.it/sandbox/shipment"
payload := strings.NewReader("{\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}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "YOUR-API-KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.gsped.it/sandbox/shipment"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
Content = new StringContent("{\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}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
curl --request POST \
--url https://api.gsped.it/sandbox/shipment \
--header 'x-api-key: YOUR-API-KEY' \
--data '{
"client_id": 390,
"colli": 2,
"contrassegno": 0,
"corriere": 104,
"ddt_alpha": "TEST_GSPED",
"ddt_num": 12346,
"origine": "IT",
"dropshipping" : 0,
"peso": 2.4,
"rcpt_addr": "115 E Endfield Rd",
"rcpt_cap": "19053",
"rcpt_city": "Feasterville Trevose",
"rcpt_contact": "Tester",
"rcpt_country_code": "US",
"rcpt_email": "test@test.it",
"rcpt_name": "TEST DESTINATARIO",
"rcpt_phone": "2159005458",
"rcpt_prov": "PA",
"servizio": 9,
"valore": 0,
"valore_doganale": 37.50,
"valuta": "EUR",
"volume": 0.0972,
"daticolli": [
{
"altezza": 39,
"larghezza": 29,
"lunghezza": 43,
"volume": 0.048633,
"peso": 1.2
},
{
"altezza": 39,
"larghezza": 29,
"lunghezza": 43,
"volume": 0.048633,
"peso": 1.2
}
],
"dettagli_ordine" : [
{
"sku" : "PBK1",
"description": "Cosa blu",
"qty": "1",
"barcode_riga": "12345464",
"hs_code": "123456454",
"prezzo_singolo": "12.50",
"peso_riga": "1"
},{
"sku" : "PBK12",
"description": "Cosa blu e rossa",
"qty": "1",
"barcode_riga": "12345465",
"hs_code": "123456454",
"prezzo_singolo": "25.00",
"peso_riga": "1"
}
]
}'
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": ""
}
{
"error": "ID spedizione non indicata"
}
{
"status": false,
"error": "Invalid API key "
}
{
"error": "Spedizione non trovata"
}
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;
}
import http.client
conn = http.client.HTTPConnection("apistaging.aws.gsped.it")
payload = ""
headers = {
'x-api-key': "YOUR-API-KEY"
}
conn.request("DELETE", "/sandbox/Shipment?id=53", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "http://apistaging.aws.gsped.it/sandbox/Shipment?id=53"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "YOUR-API-KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
// Some codevar clientHandler = new HttpClientHandler
{
UseCookies = false,
};
var client = new HttpClient(clientHandler);
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("http://apistaging.aws.gsped.it/sandbox/Shipment?id=53"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
curl --request DELETE \
--url 'http://apistaging.aws.gsped.it/sandbox/Shipment?id=53' \
--header 'x-api-key: YOUR-API-KEY'
Last updated