Products
Get product stock
Returns the current stock snapshot for one product. For SERIALS products, available_stock is calculated from currently available serial inventory.
GET
/
dev
/
v1
/
products
/
{id}
/
stock
Get product stock
curl --request GET \
--url https://api.shoppex.io/dev/v1/products/{id}/stock \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.shoppex.io/dev/v1/products/{id}/stock', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/products/{id}/stock"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/products/{id}/stock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoppex.io/dev/v1/products/{id}/stock"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"product_id": "prod_db_1",
"product_uniqid": "prod_1",
"type": "SERIALS",
"stock": 12,
"available_stock": 7,
"unlimited": false,
"variants": [
{
"id": "variant_1",
"uniqid": "variant_1",
"title": "Gold",
"stock": 5,
"available_stock": 5,
"unlimited": false
},
{
"id": "variant_2",
"uniqid": "variant_2",
"title": "Platinum",
"stock": 2,
"available_stock": 2,
"unlimited": false
}
]
}
}Previous
List product stock movementsReturns a read-only stock movement timeline synthesized from serial inventory, completed invoice sales, and allocated reseller stock transfers.
Next
⌘I
Get product stock
curl --request GET \
--url https://api.shoppex.io/dev/v1/products/{id}/stock \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.shoppex.io/dev/v1/products/{id}/stock', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/products/{id}/stock"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/products/{id}/stock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoppex.io/dev/v1/products/{id}/stock"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"product_id": "prod_db_1",
"product_uniqid": "prod_1",
"type": "SERIALS",
"stock": 12,
"available_stock": 7,
"unlimited": false,
"variants": [
{
"id": "variant_1",
"uniqid": "variant_1",
"title": "Gold",
"stock": 5,
"available_stock": 5,
"unlimited": false
},
{
"id": "variant_2",
"uniqid": "variant_2",
"title": "Platinum",
"stock": 2,
"available_stock": 2,
"unlimited": false
}
]
}
}