API Documentation
Italiano
Search
K

Orders

Caricamento ordini su Gsped
Questo endpoint serve a caricare ordini e relativi dettagli su Gsped per permetterne l'evasione via API o via interfaccia web con conseguente generazione delle etichette di spedizione.
Molto utile quando ci si trova a dover gestire diversi punti di evasione ordini che utilizzano l'interfaccia web di Gsped ma per cui non è possibile attivare un connettore per lo scarico automatico degli ordini.
get
https://api.gsped.it
/[ISTANZA]/Orders/[ID_ORDINE]
Recupera un ordine e dettagli

Snippets codice di esempio

PHP
PYTHON
GO
C#
cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gsped.it/sandbox/orders/1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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 = {
'Content-Type': "application/json",
'x-api-key': "YOUR-API-KEY"
}
conn.request("GET", "/sandbox/orders/1", 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/orders/1"
payload := strings.NewReader("")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Content-Type", "application/json")
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.Get,
RequestUri = new Uri("https://api.gsped.it/sandbox/orders/1"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
Content = new StringContent("")
{
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 GET \
--url https://api.gsped.it/sandbox/orders/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR-API-KEY'
post
https://api.gsped.it
/[ISTANZA]/Orders
Caricamento ordini e dettagli
Permette di caricare gli ordini ed i relativi dettagli su Gsped
Parameters
Header
x-api-key*
APIKEY fornita da Gsped
Body
client_id*
Int
Client ID Gsped
order_ref*
Riferimento ordine
name*
Nome Destinatario
address*
Indirizzo Destinatario
city*
Città Destinatario
zip*
Zipcode Destinatario
province*
Sigla Provincia o Stato
country*
Country code iso 2 char
email*
Indirizzo email Destinatario
phone*
Numero di telefono
cod
Float
Valore del contrasssegno
insurance
Float
Valore assicurazione
invoice_date
Data della fattura dell'ordine
invoice_number
Numero della fattura dell'ordine
notes
Note ordine
warehouse
Magazzino
rows.description
Descrizione dettaglio ordine
rows.sku
SKU dettaglio
rows.qty
Int
Quantità dettaglio
rows.hs_code
HS code dettaglio
rows.country_of_origin
Country code iso 2 char di origine della merce
rows.barcode_riga
Stringa barcode singolo item
rows.prezzo_singolo
Prezzo singolo item
rows.peso_riga
Peso singolo item
Responses
200: OK
Risposta Caricamento Ordine avvenuto
400: Bad Request
Payload Errato
403: Forbidden
Risposta apikey errata

Snippets codice di esempio

PHP
PYTHON
GO
C#
cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gsped.it/sandbox/orders",
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\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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 = "{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}"
headers = {
'Content-Type': "application/json",
'x-api-key': "YOUR-API-KEY"
}
conn.request("POST", "/sandbox/orders", 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/orders"
payload := strings.NewReader("{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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/orders"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
Content = new StringContent("{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\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/orders \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR-API-KEY' \
--data '{
"client_id": 638,
"order_ref": "test-gsped-3",
"name": "mario rossi",
"address": "piazza ambrosoli 13",
"city": "alessandria",
"zip": "15121",
"province": "AL",
"country": "IT",
"email": "[email protected]",
"phone": "01311750253",
"cod": 10,
"insurance": 0,
"notes": "testo delle note",
"customs_value": 123.45,
"currency": "EUR",
"warehouse": "",
"tag" : "pippo1",
"rows": [
{
"description" : "Cosa rossa 1",
"sku": "art3",
"qty": 1
},
{
"description" : "Cosa rossa 2",
"sku": "art4",
"qty": 2
}
]
}'
patch
https://api.gsped.it
/[ISTANZA]/Orders/[ID_ORDINE]
Modifica ordini e dettagli di ordine esistente

Snippets codice di esempio

PHP
PYTHON
GO
C#
cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gsped.it/sandbox/orders/1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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 = "{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}"
headers = {
'Content-Type': "application/json",
'x-api-key': "YOUR-API-KEY"
}
conn.request("PATCH", "/sandbox/orders/1", 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/orders/1"
payload := strings.NewReader("{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
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.Patch,
RequestUri = new Uri("https://api.gsped.it/sandbox/orders/1"),
Headers =
{
{ "x-api-key", "YOUR-API-KEY" },
},
Content = new StringContent("{\n \"client_id\": 638,\n \"order_ref\": \"test-gsped-3\",\n \"name\": \"mario rossi\",\n \"address\": \"piazza ambrosoli 13\",\n \"city\": \"alessandria\",\n \"zip\": \"15121\",\n \"province\": \"AL\",\n \"country\": \"IT\",\n \"email\": \"[email protected]\",\n \"phone\": \"01311750253\",\n \"cod\": 10,\n \"insurance\": 0,\n \"notes\": \"testo delle note\",\n \"customs_value\": 123.45,\n \"currency\": \"EUR\",\n \"warehouse\": \"\",\n \"tag\" : \"pippo1\",\n \"rows\": [\n {\n \t\"description\" : \"Cosa rossa 1\",\n \"sku\": \"art3\",\n \"qty\": 1\n },\n {\n \t\"description\" : \"Cosa rossa 2\",\n \"sku\": \"art4\",\n \"qty\": 2\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 PATCH \
--url https://api.gsped.it/sandbox/orders/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR-API-KEY' \
--data '{
"client_id": 638,
"order_ref": "test-gsped-3",
"name": "mario rossi",
"address": "piazza ambrosoli 13",
"city": "alessandria",
"zip": "15121",
"province": "AL",
"country": "IT",
"email": "[email protected]",
"phone": "01311750253",
"cod": 10,
"insurance": 0,
"notes": "testo delle note",
"customs_value": 123.45,
"currency": "EUR",
"warehouse": "",
"tag" : "pippo1",
"rows": [
{
"description" : "Cosa rossa 1",
"sku": "art3",
"qty": 1
},
{
"description" : "Cosa rossa 2",
"sku": "art4",
"qty": 2
}
]
}'