Obtenir la disponibilitat d'estoc d'un producte
inventory:products.readhttps://api.holded.com/api/v2/products/{productId}/stockRetorna la disponibilitat d'estoc d'un producte, desglossada en quantitats totals, disponibles, reservades i en trànsit, així com l'estoc físic emmagatzemat en cada magatzem.
Paràmetres
Paràmetres de ruta
stringobligatoriID del producte (ObjectId hexadecimal de 24 caràcters)
Petició
import requests
url = "https://api.holded.com/api/v2/products/{productId}/stock"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
response = requests.get(url, headers=headers)
print(response.json())Respostes
Resposta
{
"product_id": "507f1f77bcf86cd799439011",
"has_stock": false,
"total": "15.3",
"available": "10",
"reserved": "5.3",
"in_transit": "2",
"warehouses": [
{
"warehouse_id": "string",
"stock": "5",
"variants": [
{
"variant_id": "...",
"stock": "..."
}
]
}
]
}Respostes exitoses
200Disponibilitat d'estoc del producteapplication/jsonUnique identifier of the product
Whether the product has stock tracking enabled
Total stock across all warehouses as a decimal string
Stock available for sale (total minus reserved) as a decimal string
Stock committed to pending sales orders as a decimal string
Stock incoming from purchase orders as a decimal string
Physical stock per warehouse
Identifier of the warehouse
Stock stored in this warehouse as a decimal string
Stock per variant in this warehouse. Only present for products with variants (variants, lots, serialnumbers).
Respostes d'error
401API key no vàlida o no proporcionadaapplication/json403Permisos insuficientsapplication/json404Producte no trobatapplication/json429Límit de sol·licituds exceditapplication/json