Mettre à jour la disponibilité des articles
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_bodyMettre à jour la disponibilité des articles
Utilisez l’API POS availability pour mettre à jour les stocks par code PLU, marquer des articles en rupture et synchroniser l’inventaire en temps réel.
POST
/
pos
/
availability
Mettre à jour la disponibilité des articles
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_bodyMettez à jour le statut de disponibilité et le nombre d’unités en stock pour les articles de menu d’un magasin. Les articles sont identifiés par leur code PLU (Price Look-Up).
Requête
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
}
]
}'
Corps de la requête
string
required
L’identifiant externe du magasin (format UUID). Il s’agit de l’ID que vous avez attribué au magasin lors de la mise en place de votre intégration.
array
required
Un tableau d’articles à mettre à jour. Doit contenir au moins un article.
Show Propriétés de l'article
Show Propriétés de l'article
string
required
Le code PLU de l’article de menu. Doit correspondre au PLU configuré dans le tableau de bord storekit.
boolean
required
Indique si l’article est actuellement disponible à la commande.
integer
Le nombre d’unités actuellement en stock. Doit être supérieur ou égal à 0. Lorsque l’inventaire atteint 0, envisagez de définir
isAvailable sur false.Réponse
"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"
}
Comportement
- Les articles sont identifiés par PLU dans le menu actif du magasin
- Si le PLU d’un article est introuvable, il est ignoré silencieusement (aucune erreur renvoyée)
- Les changements de disponibilité prennent effet immédiatement
- Le cache du menu est automatiquement invalidé après les mises à jour
Exemple : marquer des articles comme épuisés
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
}
]
}'
Exemple : réapprovisionner des articles
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