# Shipment by DDT Alpha

## Shipment by DDT Alpha - GET

Restituisce le informazioni riguardo a una spedizione insieme alle relative etichette nei formati disponibili esattamente come la [Shipment](/spedizioni-e-dintorni/shipment.md#shipment-get) ma utilizzando come parametro per la ricerca il **riferimento alfanumerico** passato in fase di creazione.

{% hint style="info" %}
Il Riferimento alfanumerico deve essere univoco per poter utilizzare questo endpoint
{% endhint %}

**In caso l'utente a cui è associata l'apikey gestisca più anagrafiche** e ci sia il rischio di sovrapposizione di riferimenti alfanumerici è possibile passare un parametro aggiuntivo **client\_id** valorizzato con l'intero che indica su quale delle anagrafiche andare a filtrare ulteriormente.

{% hint style="info" %}
La lista dei client\_id che gestisce un utente è fornita da Gsped alla fine di ogni configurazione.
{% endhint %}

## Recupero informazioni spedizione

<mark style="color:blue;">`GET`</mark> `https://api.gsped.it/[ISTANZA]/ShipmentByDdtalpha`

Recupera le informazioni di una spedizione usando come campo di ricerca il riferimento alfanumerico

#### Query Parameters

| Name                                         | Type   | Description                               |
| -------------------------------------------- | ------ | ----------------------------------------- |
| ddt\_alpha<mark style="color:red;">\*</mark> | String | Riferimento alfanumerico della spedizione |
| client\_id                                   | String | ID anagrafica di bollettazione            |

#### Headers

| Name                                        | Type   | Description             |
| ------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | APIKEY fornita da Gsped |

{% tabs %}
{% tab title="200: OK Dati spedizione" %}

```javascript
{
  "client_id": 390,
  "cod_destinatario": "",
  "colli": 1,
  "contrassegno": 0,
  "corriere": 2,
  "date_req_cons": "0000-00-00 00:00:00",
  "ddt_alpha": "55880",
  "ddt_num": 70059765,
  "merce": "",
  "note_sender": "",
  "origine": "",
  "peso": 5.6,
  "preavviso_telefonico": "",
  "rcpt_addr": "MOLO VENEZIA 10",
  "rcpt_cap": 34121,
  "rcpt_city": "TRIESTE",
  "rcpt_contact": "test contact2",
  "rcpt_country_code": "IT",
  "rcpt_email": "test@gsped.com",
  "rcpt_name": "Test destinatariotesto aggiuntivo",
  "rcpt_phone": 1234545789,
  "rcpt_prov": "TS",
  "servizio": 11,
  "tipo_incasso": 0,
  "valore": 0,
  "valore_doganale": 1,
  "volume": 0,
  "status": 0,
  "fid_partenza": "MI10",
  "num_serie": 0,
  "num_spedizione": "WS12345678",
  "date_upd": "0000-00-00 00:00:00",
  "error": "",
  "sender_name": "Test Mittente",
  "sender_addr": "Via Cavour 15",
  "sender_cap": 20123,
  "sender_city": "Milano",
  "sender_contact": "test contact",
  "sender_prov": "MI",
  "sender_country_code": "IT",
  "sender_email": "test@gsped.com",
  "label_jpg": [
    "base64 encoded label string"
  ],
  "label_pdf": [
    "base64 encoded label string"
  ],
  "label_zpl": [
    "ZPL label string"
  ],
  "id": 70059765,
  "daticolli": [
    {
      "peso": 5.6,
      "volume": 0,
      "larghezza": 0,
      "lunghezza": 0,
      "altezza": 0,
      "n_collo": 1,
      "barcode": "4646466464test4646"
    }
  ],
  "tnt_options": [],
  "tracking_link": "",
  "sender_phone": 41321234,
  "dropshipping": 0,
  "valuta": "",
  "al_piano": "",
  "al_sabato": "",
  "reso_contestuale": "",
  "fermo_deposito": 0,
  "note": "",
  "centro_costo": "",
  "sda_servizio": "",
  "date_req_ritiro": "0000-00-00 00:00:00",
  "opening_time": "00:00:00",
  "closing_time": "00:00:00",
  "barcode": "T70059765",
  "ups_uap_id": 0,
  "sda_id_fermoposta": "",
  "flag_reso": 0,
  "note_2": "",
  "documenti": 0,
  "brt_num_segnacollo_da": 0,
  "brt_num_segnacollo_a": 0,
  "confermato": 1,
  "ups_signature_required": 0,
  "id_pickup": null,
  "data_consegna_prevista": "0000-00-00 00:00:00",
  "sda_accessori": 0,
  "codice_merce_fercam": "",
  "milkman_tracking_code": "WS24881051",
  "opening_time2": "00:00:00",
  "closing_time2": "00:00:00",
  "chi_paga": 0,
  "dangerous_goods": "",
  "vat_seller": "",
  "vat_buyer": "",
  "generic_service_point": "",
  "user_id": 0,
  "sender_eori": "",
  "rcpt_eori": "",
  "link_pickup_booking": ""
}
```

{% endtab %}

{% tab title="400: Bad Request Errore input" %}

```javascript
{
  "error": "DDT_alpha spedizione non indicata(1)"
}
```

{% endtab %}

{% tab title="404: Not Found Spedizione non trovata" %}

```javascript
{
  "error": "Spedizione non trovata (10)"
}
```

{% endtab %}

{% tab title="403: Forbidden Invalid Credential" %}

```javascript
{
  "status": false,
  "error": "Invalid API key "
}
```

{% endtab %}
{% endtabs %}

### Snippets codice di esempio

{% tabs %}
{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test1234567",
  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;
}
```

{% endtab %}

{% tab title="PYTHON" %}

```python
import http.client

conn = http.client.HTTPSConnection("api.gsped.it")

payload = ""

headers = { 'x-api-key': "YOUR-API-KEY" }

conn.request("GET", "/sandbox/ShipmentByDdtalpha?ddt_alpha=test1234567", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test1234567"

	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))

}
```

{% endtab %}

{% tab title="C#" %}

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test1234567"),
    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);
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --request GET \
  --url 'https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test1234567' \
  --header 'x-api-key: YOUR-API-KEY'
```

{% endtab %}
{% endtabs %}

## Shipment by DDT Alpha - DELETE

## Cancella una spedizione

<mark style="color:red;">`DELETE`</mark> `https://api.gsped.it/[ISTANZA]/ShipmentByDdtalpha`

Cancella una spedizione utilizzando come chiave di ricerca il riferimento alfanumerico

#### Query Parameters

| Name                                         | Type   | Description                               |
| -------------------------------------------- | ------ | ----------------------------------------- |
| ddt\_alpha<mark style="color:red;">\*</mark> | String | Riferimento alfanumerico della spedizione |
| client\_id                                   | String | ID anagrafica di bollettazione            |

#### Headers

| Name                                        | Type   | Description             |
| ------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | APIKEY fornita da Gsped |

{% tabs %}
{% tab title="200: OK Cancellazione avvenuta" %}

```javascript
{
  "error": ""
}
```

{% endtab %}

{% tab title="400: Bad Request Errore input" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="403: Forbidden Apikey invalida" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found Spedizione non trovata" %}

```javascript
{
  "error": "Spedizione non trovata (10)"
}
```

{% endtab %}

{% tab title="400: Bad Request DDT non univoco" %}

```javascript
{
  "error": "ddt_alpha non univoco"
}
```

{% endtab %}
{% endtabs %}

## Snippets codice di esempio

{% tabs %}
{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test123456",
  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;
}
```

{% endtab %}

{% tab title="PYTHON" %}

```python
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test123456",
  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;
}
```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test123456"

	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))

}
```

{% endtab %}

{% tab title="C#" %}

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Delete,
    RequestUri = new Uri("https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test123456"),
    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);
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --request DELETE \
  --url 'https://api.gsped.it/sandbox/ShipmentByDdtalpha?ddt_alpha=test123456' \
  --header 'x-api-key: YOUR-API-KEY'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.gsped.com/spedizioni-e-dintorni/shipment-by-ddt-alpha.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
