Get inventory history - Fabric
Get inventory history
cURL
curl --request GET \
--url https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/ \
--header 'Authorization: Bearer <token>'
Python
import requests
url = "https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/",
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;
}
?>
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/"
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))
}
Unirest (Java)
HttpResponse<String> response = Unirest.get("https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/")
.header("Authorization", "Bearer <token>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/inventory/{id}/history/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body
Response Example
{
"inventory_updated_at": "2024-04-15T12:00:00Z",
"inventory_last_submitted_at": "2024-04-15T12:05:00Z",
"brand_inventory_updated_at": "2024-04-14T08:30:00Z",
"sellable_updated_at": "2024-04-10T09:15:00Z",
"estimated_availability_date": "2024-05-01",
"connection": "conn-12345",
"variant": "SKU-001-BLUE",
"inventory_policy": "managed",
"inventory": "150",
"discontinued": false,
"discontinued_updated_at": "2024-03-01T10:00:00Z",
"replenishable": true,
"sellable": "yes",
"locations": "Warehouse A, Warehouse B"
}
Authorizations
Authorization
- Type: string
- Location: header
- Required: Bearer authentication header of the form
Bearer <token>.
Path Parameters
retailer_id: integer (required)
- The unique retailer ID.
- Example:
1001
id: integer (required)
- The unique inventory item identifier.
- Example:
6006
Response Structure
- 200 - application/json: OK
- inventory_updated_at: string
(required) - Timestamp when the inventory was last updated by the retailer
- inventory_last_submitted_at: string
(required) - Timestamp when inventory was last submitted to the platform
- brand_inventory_updated_at: string
(required) - Timestamp when the brand last updated the inventory
- sellable_updated_at: string
(required) - Timestamp when the sellable status was last updated
- estimated_availability_date: string (required)
- Estimated date when the product will be back in stock or available
- connection: string (read-only)
- The connection through which the inventory is managed
- variant: string (read-only)
- The variant (SKU) of the product
- inventory_policy: enum
- Determines how inventory is managed for this variant
- Available options:
unmanaged,managed
- inventory: string (read-only)
- Current available inventory quantity
- discontinued: boolean (read-only)
- Indicates if the product variant is discontinued
- discontinued_updated_at: string
(read-only) - Timestamp when the discontinued status was last updated
- replenishable: boolean (read-only)
- Indicates if the product is regularly replenished
- sellable: string (read-only)
- Indicates if the product is currently sellable
- locations: string (read-only)
- List of locations where inventory is held, separated by commas.
- inventory_updated_at: string