List all storefront links. Filter by brand IDs, link IDs, storefront IDs, and sources.
Method: GET (paginated)
Parameters:
Response:
{
"links": [
{
"storefrontName": "string",
"storefrontId": "string",
"brandId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"levantaProductCount": 0,
"id": "string",
"sourceId": "string",
"sourceSubId": "string",
"sourceName": "string",
"url": "string",
"active": true,
"type": "product",
"marketplace": "amazon.com"
}
],
"cursor": "string"
}
Errors:
Example:
const API_KEY = "LEVANTA_API_KEY";
const ENDPOINT = "<https://app.levanta.io/api/creator/v1/links/storefronts>";
let cursor;
const links = [];
// Set up query parameters
const parameters = new URLSearchParams();
// Get 50 links per response
parameters.set("limit", 50);
// Limit links to two links by their IDs
parameters.set("link_ids", "lv_t7k6xaVsiym8uU5mSl,lv_OQgghVZKul3NS88CRp");
// Only links created for brands by the brand's id
parameters.set("brand_ids", "abc_123, def_456, ghi_789");
// Limit links to ones created with the "default" id
parameters.set("source_ids", "default");
// Paginate through links, stop when a value of null is returned for "cursor"
while (cursor !== null) {
const response = await fetch(`${ENDPOINT}?${parameters.toString()}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
});
const json = await response.json();
// Store links returned
links.push(...json.links);
cursor = json.cursor;
if (cursor) parameters.set("cursor", cursor);
}
console.log(links);