ShipmentFromCourier
Introduzione
Questo endpoint nasce come punto di ingresso per flussi informativi che risiedono su altri sistemi o integrazioni.
Si tratta di un endpoint chiamato in POST con payload in JSON.
Specifiche chiamata
Esempio payload
{
"client_id" : 2,
"instance" : "testbed",
"courier" : 104,
"shipment_number" : "123456789",
"reference_1" : 11223,
"reference_2": "11223",
"parcels" : 1,
"status" : "PU",
"weight": 2.5,
"volume": 0.005,
"service": "N",
"insurance": 0.0,
"cod": 0.0,
"parcel_details": [
{
"barcode": "12345",
"weight": 2.5,
"volume": 0.005,
"height": 10,
"length": 10,
"width": 10,
"type": "crt"
}
],
"sender_info": {
"name": "test",
"address": "via delle Glorie 5",
"city": "Alessandria",
"zipcode": "15121",
"state": "AL",
"country": "IT",
"phone": "1231212123",
"mail": "[email protected]"
},
"recipient_info": {
"name": "test",
"address": "via delle rose 14",
"city": "Milano",
"zipcode": "20121",
"state": "MI",
"country": "IT",
"phone": "1231212123",
"mail": "[email protected]"
},
"order_id": 4743
}
Definizione campi
Headers
x-api-key
String
Apikey rilasciata da Gsped
Request Body
instance
String
Istanza Gsped
parcels
Int
Numero colli della spedizione
volume
Float
Volume spedizione in Metri Cubi
weight
Float
Peso spedizione espresso in KG
shipment_number
String
Numero di spedizione
status
String
Codice stato spedizione in formato corriere
reference_1
String
Riferimento numerico della spedizione
reference_2
String
Riferimento alfanumerico della spedizione
client_id
Int
ID cliente fornito da Gsped
service
String
Codice servizio in formato corriere
order_id
Int
ID Gsped dell'ordine associato alla spedizione
Address Object
name
String
Nome
address
String
Indirizzo
city
String
Nome della località
zipcode
String
Codice postale
state
String
Nome provincia/stato
country
String
Iso code 2 char della nazione
phone
String
Numero di telefono
String
Indirizzo email
Parcel_data Object
barcode
String
Codice barcode
weight
Float
Peso in KG
volume
Float
Volume in Mc
height
Int
Altezza in CM
length
Int
Lunghezza in CM
width
Int
Profondità in CM
type
String
Tipologia di collo
Esempi di codice
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiproduction.gsped.it/testbed/ShipmentFromCourier",
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\t\"client_id\" : 2,\n\t\"instance\" : \"testbed\",\n\t\"courier\" : 104,\n\t\"shipment_number\" : \"123456789\",\n\t\"reference_1\" : 11223,\n\t\"reference_2\": \"11223\",\n\t\"parcels\" : 1,\n\t\"status\" : \"PU\",\n\t\"weight\": 2.5,\n\t\"volume\": 0.005,\n\t\"service\": \"N\",\n\t\"insurance\": 0.0,\n\t\"cod\": 0.0,\n\t\"parcel_details\": [\n\t\t{\n\t\t\t\"barcode\": \"12345\",\n\t\t\t\"weight\": 2.5,\n\t\t\t\"volume\": 0.005,\n\t\t\t\"height\": 10,\n\t\t\t\"length\": 10,\n\t\t\t\"width\": 10,\n\t\t\t\"type\": \"crt\"\n\t\t}\n\t],\n\t\"sender_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle Glorie 5\",\n\t\t\"city\": \"Alessandria\",\n\t\t\"zipcode\": \"15121\",\n\t\t\"state\": \"AL\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"recipient_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle rose 14\",\n\t\t\"city\": \"Milano\",\n\t\t\"zipcode\": \"20121\",\n\t\t\"state\": \"MI\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"order_id\": 4743\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: 9515986E77D2F2CEE97C572D6943E"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Python
import http.client
conn = http.client.HTTPSConnection("apiproduction.gsped.it")
payload = "{\n\t\"client_id\" : 2,\n\t\"instance\" : \"testbed\",\n\t\"courier\" : 104,\n\t\"shipment_number\" : \"123456789\",\n\t\"reference_1\" : 11223,\n\t\"reference_2\": \"11223\",\n\t\"parcels\" : 1,\n\t\"status\" : \"PU\",\n\t\"weight\": 2.5,\n\t\"volume\": 0.005,\n\t\"service\": \"N\",\n\t\"insurance\": 0.0,\n\t\"cod\": 0.0,\n\t\"parcel_details\": [\n\t\t{\n\t\t\t\"barcode\": \"12345\",\n\t\t\t\"weight\": 2.5,\n\t\t\t\"volume\": 0.005,\n\t\t\t\"height\": 10,\n\t\t\t\"length\": 10,\n\t\t\t\"width\": 10,\n\t\t\t\"type\": \"crt\"\n\t\t}\n\t],\n\t\"sender_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle Glorie 5\",\n\t\t\"city\": \"Alessandria\",\n\t\t\"zipcode\": \"15121\",\n\t\t\"state\": \"AL\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"recipient_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle rose 14\",\n\t\t\"city\": \"Milano\",\n\t\t\"zipcode\": \"20121\",\n\t\t\"state\": \"MI\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"order_id\": 4743\n}"
headers = {
'Content-Type': "application/json",
'x-api-key': "9515986E77D2F2CEE97C572D6943E"
}
conn.request("POST", "/testbed/ShipmentFromCourier", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
GO
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://apiproduction.gsped.it/testbed/ShipmentFromCourier"
payload := strings.NewReader("{\n\t\"client_id\" : 2,\n\t\"instance\" : \"testbed\",\n\t\"courier\" : 104,\n\t\"shipment_number\" : \"123456789\",\n\t\"reference_1\" : 11223,\n\t\"reference_2\": \"11223\",\n\t\"parcels\" : 1,\n\t\"status\" : \"PU\",\n\t\"weight\": 2.5,\n\t\"volume\": 0.005,\n\t\"service\": \"N\",\n\t\"insurance\": 0.0,\n\t\"cod\": 0.0,\n\t\"parcel_details\": [\n\t\t{\n\t\t\t\"barcode\": \"12345\",\n\t\t\t\"weight\": 2.5,\n\t\t\t\"volume\": 0.005,\n\t\t\t\"height\": 10,\n\t\t\t\"length\": 10,\n\t\t\t\"width\": 10,\n\t\t\t\"type\": \"crt\"\n\t\t}\n\t],\n\t\"sender_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle Glorie 5\",\n\t\t\"city\": \"Alessandria\",\n\t\t\"zipcode\": \"15121\",\n\t\t\"state\": \"AL\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"recipient_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle rose 14\",\n\t\t\"city\": \"Milano\",\n\t\t\"zipcode\": \"20121\",\n\t\t\"state\": \"MI\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"order_id\": 4743\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("x-api-key", "9515986E77D2F2CEE97C572D6943E")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
C#
var client = new RestClient("https://apiproduction.gsped.it/testbed/ShipmentFromCourier");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "9515986E77D2F2CEE97C572D6943E");
request.AddParameter("application/json", "{\n\t\"client_id\" : 2,\n\t\"instance\" : \"testbed\",\n\t\"courier\" : 104,\n\t\"shipment_number\" : \"123456789\",\n\t\"reference_1\" : 11223,\n\t\"reference_2\": \"11223\",\n\t\"parcels\" : 1,\n\t\"status\" : \"PU\",\n\t\"weight\": 2.5,\n\t\"volume\": 0.005,\n\t\"service\": \"N\",\n\t\"insurance\": 0.0,\n\t\"cod\": 0.0,\n\t\"parcel_details\": [\n\t\t{\n\t\t\t\"barcode\": \"12345\",\n\t\t\t\"weight\": 2.5,\n\t\t\t\"volume\": 0.005,\n\t\t\t\"height\": 10,\n\t\t\t\"length\": 10,\n\t\t\t\"width\": 10,\n\t\t\t\"type\": \"crt\"\n\t\t}\n\t],\n\t\"sender_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle Glorie 5\",\n\t\t\"city\": \"Alessandria\",\n\t\t\"zipcode\": \"15121\",\n\t\t\"state\": \"AL\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"recipient_info\": {\n\t\t\"name\": \"test\",\n\t\t\"address\": \"via delle rose 14\",\n\t\t\"city\": \"Milano\",\n\t\t\"zipcode\": \"20121\",\n\t\t\"state\": \"MI\",\n\t\t\"country\": \"IT\",\n\t\t\"phone\": \"1231212123\",\n\t\t\"mail\": \"[email protected]\"\n\t},\n\t\"order_id\": 4743\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Curl
curl --request POST \
--url https://apiproduction.gsped.it/testbed/ShipmentFromCourier \
--header 'Content-Type: application/json' \
--header 'x-api-key: 9515986E77D2F2CEE97C572D6943E' \
--data '{
"client_id" : 2,
"instance" : "testbed",
"courier" : 104,
"shipment_number" : "123456789",
"reference_1" : 11223,
"reference_2": "11223",
"parcels" : 1,
"status" : "PU",
"weight": 2.5,
"volume": 0.005,
"service": "N",
"insurance": 0.0,
"cod": 0.0,
"parcel_details": [
{
"barcode": "12345",
"weight": 2.5,
"volume": 0.005,
"height": 10,
"length": 10,
"width": 10,
"type": "crt"
}
],
"sender_info": {
"name": "test",
"address": "via delle Glorie 5",
"city": "Alessandria",
"zipcode": "15121",
"state": "AL",
"country": "IT",
"phone": "1231212123",
"mail": "[email protected]"
},
"recipient_info": {
"name": "test",
"address": "via delle rose 14",
"city": "Milano",
"zipcode": "20121",
"state": "MI",
"country": "IT",
"phone": "1231212123",
"mail": "[email protected]"
},
"order_id": 4743
}'
Limitazioni
Al momento questo endpoint è disponibile solo per i corrieri:
DHL
GLS
In futuro verrà espanso, visitate la documentazione ad intervalli regolari per essere aggiornati.
Last updated
Was this helpful?