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

Path Parameters

Response Structure