Saltar al contingut principal
GET

Obtenir la disponibilitat d'estoc d'un producte

Scope:inventory:products.read
https://api.holded.com/api/v2/products/{productId}/stock

Retorna 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

productIdstringobligatori

ID del producte (ObjectId hexadecimal de 24 caràcters)

Petició

python
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

json
{
  "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/json
object
product_idstringrequired

Unique identifier of the product

has_stockbooleanrequired

Whether the product has stock tracking enabled

totalstringrequired

Total stock across all warehouses as a decimal string

availablestringrequired

Stock available for sale (total minus reserved) as a decimal string

reservedstringrequired

Stock committed to pending sales orders as a decimal string

in_transitstringrequired

Stock incoming from purchase orders as a decimal string

warehouses[]object[]required

Physical stock per warehouse

warehouse_idstringrequired

Identifier of the warehouse

stockstringrequired

Stock stored in this warehouse as a decimal string

variants[]object[]optional

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/json
403Permisos insuficientsapplication/json
404Producte no trobatapplication/json
429Límit de sol·licituds exceditapplication/json