Aggiornare la disponibilità degli articoli
curl --request POST \
--url https://api.example.com/pos/availability \
--header 'Content-Type: application/json' \
--data '
{
"storeId": "<string>",
"items": [
{
"plu": "<string>",
"isAvailable": true,
"inventory": 123
}
]
}
'import requests
url = "https://api.example.com/pos/availability"
payload = {
"storeId": "<string>",
"items": [
{
"plu": "<string>",
"isAvailable": True,
"inventory": 123
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
storeId: '<string>',
items: [{plu: '<string>', isAvailable: true, inventory: 123}]
})
};
fetch('https://api.example.com/pos/availability', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/pos/availability",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'storeId' => '<string>',
'items' => [
[
'plu' => '<string>',
'isAvailable' => true,
'inventory' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/pos/availability"
payload := strings.NewReader("{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/pos/availability")
.header("Content-Type", "application/json")
.body("{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/pos/availability")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyAggiornare la disponibilità degli articoli
Usa l’API di disponibilità POS per aggiornare le giacenze degli articoli via codice PLU, contrassegnare esauriti e sincronizzare l’inventario in tempo reale.
POST
/
pos
/
availability
Aggiornare la disponibilità degli articoli
curl --request POST \
--url https://api.example.com/pos/availability \
--header 'Content-Type: application/json' \
--data '
{
"storeId": "<string>",
"items": [
{
"plu": "<string>",
"isAvailable": true,
"inventory": 123
}
]
}
'import requests
url = "https://api.example.com/pos/availability"
payload = {
"storeId": "<string>",
"items": [
{
"plu": "<string>",
"isAvailable": True,
"inventory": 123
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
storeId: '<string>',
items: [{plu: '<string>', isAvailable: true, inventory: 123}]
})
};
fetch('https://api.example.com/pos/availability', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/pos/availability",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'storeId' => '<string>',
'items' => [
[
'plu' => '<string>',
'isAvailable' => true,
'inventory' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/pos/availability"
payload := strings.NewReader("{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/pos/availability")
.header("Content-Type", "application/json")
.body("{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/pos/availability")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"storeId\": \"<string>\",\n \"items\": [\n {\n \"plu\": \"<string>\",\n \"isAvailable\": true,\n \"inventory\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyAggiorna lo stato di disponibilità e la quantità di inventario degli articoli del menu in un negozio. Gli articoli vengono identificati tramite il loro codice PLU (Price Look-Up).
Richiesta
curl -X POST https://api.storekit.com/pos/availability \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"storeId": "550e8400-e29b-41d4-a716-446655440000",
"items": [
{
"plu": "BURGER-001",
"isAvailable": true,
"inventory": 50
},
{
"plu": "FRIES-001",
"isAvailable": false
}
]
}'
Corpo della richiesta
string
required
L’ID esterno del negozio (formato UUID). È l’ID che hai assegnato al negozio quando hai configurato la tua integrazione.
array
required
Un array di articoli da aggiornare. Deve contenere almeno un articolo.
Show Proprietà dell'articolo
Show Proprietà dell'articolo
string
required
Il codice PLU dell’articolo del menu. Deve corrispondere al PLU configurato nella dashboard storekit.
boolean
required
Indica se l’articolo è attualmente disponibile per l’ordinazione.
integer
La quantità di inventario attuale. Deve essere 0 o superiore. Quando l’inventario raggiunge 0, considera di impostare
isAvailable su false.Risposta
"ok"
{
"statusCode": 404,
"error": "Not Found",
"message": "Not Found"
}
{
"statusCode": 404,
"error": "Not Found",
"message": "No active menu found for this venue"
}
{
"statusCode": 400,
"error": "Bad Request",
"message": "\"storeId\" must be a valid GUID"
}
Comportamento
- Gli articoli vengono abbinati tramite PLU all’interno del menu attivo del negozio
- Se il PLU di un articolo non viene trovato, viene ignorato in modo silenzioso (nessun errore restituito)
- Le modifiche di disponibilità hanno effetto immediato
- La cache del menu viene invalidata automaticamente dopo gli aggiornamenti
Esempio: contrassegnare articoli come esauriti
curl -X POST https://api.storekit.com/pos/availability \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"storeId": "550e8400-e29b-41d4-a716-446655440000",
"items": [
{
"plu": "SPECIAL-001",
"isAvailable": false,
"inventory": 0
}
]
}'
Esempio: rifornire articoli
curl -X POST https://api.storekit.com/pos/availability \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"storeId": "550e8400-e29b-41d4-a716-446655440000",
"items": [
{
"plu": "SPECIAL-001",
"isAvailable": true,
"inventory": 25
},
{
"plu": "DESSERT-001",
"isAvailable": true,
"inventory": 10
}
]
}'
Was this page helpful?
⌘I