# Reprint

Endpoint di utilità per rigenerare i files di stampa delle etichette di una spedizione, può essere utilizzato se si dispone di una Gsped Labeling Machine o se si recuperano le etichette via FTP.

## Ristampa le etichette

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

#### Path Parameters

| Name                                             | Type   | Description                 |
| ------------------------------------------------ | ------ | --------------------------- |
| id\_spedizione<mark style="color:red;">\*</mark> | String | ID univoco spedizione Gsped |

#### Headers

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

{% tabs %}
{% tab title="200: OK Risposta etichetta stampata" %}

```javascript
{
    "result": "OK"
}
```

{% endtab %}

{% tab title="403: Forbidden Risposta apikey invalida" %}

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

{% endtab %}

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

```javascript
{
  "error": "Spedizione non trovata"
}
```

{% endtab %}

{% tab title="400: Bad Request Parametri invalidi" %}

```javascript
{
  "error": "ID Spedizione deve essere un intero"
}
```

{% 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/reprint/1234",
  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/reprint/1234", 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/reprint/1234"

	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/reprint/1234"),
    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" %}

```bash
curl --request GET \
  --url https://api.gsped.it/sandbox/reprint/1234 \
  --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/reprint.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.
