Widget Settings
GET
https://rebuyengine.com/api/v1/widgets/settings?id={widget_id}&cache_key={cache_key}Requirements
In order to get the most up to date widget settings from this endpoint, you must pull your cache key from your store'suser/config. This can be done by either accessing window.Rebuy.shop.cache_key or by hitting this endpoint:
https://rebuyengine.com/api/v1/user/config?shop={{myshopify domain here}}
and pulling it from data.shop.cache_key.
Query Parameters¶
key· string · required- Your Rebuy public API key. Find this in your Rebuy admin under Settings → API Keys.
widget_id· string- The ID of the widget you need settings for
cache_key· string- Your store's cache key
Code Example¶
// GET https://cached.rebuyengine.com/api/v1/widgets/settings
const API_KEY = "YOUR_PUBLIC_API_KEY";
const widgetId = "12345";
const cacheKey = window.Rebuy?.shop?.cache_key || "YOUR_CACHE_KEY";
fetch(`https://cached.rebuyengine.com/api/v1/widgets/settings?key=${API_KEY}&id=${widgetId}&cache_key=${cacheKey}`)
.then(response => response.json())
.then(data => console.log(data));
Response Example¶
{
"data": {
"id": 12345,
"name": "Product Page Cross-Sell",
"type": "product_recommendation",
"settings": {
"title": "You may also like",
"limit": 4,
"layout": "grid"
}
},
"metadata": {
"cache_key": "abc123",
"cached_at": "2024-01-15T10:30:00Z"
}
}
See something that needs updating?
Suggest an edit