Tracking
Tracking spedizione su Gsped
Endpoint utile per consultare lo status di una spedizione.
E' possibile cercare la spedizione attraverso uno dei seguenti parametri :
- id : ID della spedizione 
- ddt_num : Riferimento numerico della spedizione 
- ddt_alpha : Riferimento alfanumerico della spedizione 
Nota bene : E' indispensabile che venga indicato almeno uno dei parametri appena evidenziati
Nel caso in cui i riferimenti utilizzati nella propria istanza non siano univoci, se si utilizzano il ddt_num e/o il ddt_alpha come parametri nella risposta si troverà un array con i dati di tutte le spedizioni corrispondenti ai parametri passati.
Recupera lo status della spedizione
GET https://api.gsped.it/[ISTANZA]/tracking
Path Parameters
id
Integer
ID della spedizione
ddt_num
String
Riferimento numerico della spedizione
ddt_alpha
String
Riferimento alfanumerico della spedizione
Headers
x-api-key*
String
APIKEY fornita da Gsped
{
    "status_code": 19,
    "status": "CONSEGNATO",
    "delivery_date": "2021-03-30 11:00:00",
    "fid_partenza": 2,
    "num_serie": 1,
    "num_spedizione": "0585596",
    "corriere_id": 1,
    "corriere": "BRT",
    "ddt_num": 18795,
    "ddt_alpha": "100027946",
    "client_id": 1,
    "tracking_link": "https://vas.brt.it/vas/sped_det_show.hsm?nspediz=002010585132",
    "id_gsped": 18795
}{
    "error": "Spedizione non trovata"
}{
    "error": "Riferimento spedizione non indicato"
}{
    "status": false,
    "error": "Invalid API key "
}Snippets codice di esempio : 
Esempi di chiamate utilizzando il campo id
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.gsped.it/sandbox/tracking?id=18795',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => array(
        'x-api-key: YOUR-API-KEY'
    ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;import http.client
conn = http.client.HTTPSConnection("api.gsped.it")
payload = ''
headers = {
  'x-api-key': 'YOUR-API-KEY'
}
conn.request("GET", "/sandbox/tracking?id=jhon", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))phpackage main
import (
  "fmt"
  "net/http"
  "io/ioutil"
)
func main() {
  url := "https://api.gsped.it/sandbox/tracking?id=jhon"
  method := "GET"
  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)
  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("x-api-key", "YOUR-API-KEY")
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}var clientHandler = new HttpClientHandler
{
    UseCookies = false,
};
var client = new HttpClient(clientHandler);
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("https://api.gsped.it/sandbox/tracking?id=18795"),
    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 --location --request GET 'https://api.gsped.it/sandbox/tracking?id=jhon' \
--header 'x-api-key: YOUR-API-KEY'Last updated
Was this helpful?
