Recommendations API Overview
The Recommendations API delivers personalized and contextually relevant product recommendations based on a supplied URL or route name.
Key Concepts
- Route: Determined by URL pattern matching or directly specified by name, routes control which widgets are displayed
- Widget: UI components that contain slots for displaying recommendations
- Slot: Positions within widgets that contain recommended products or promotional banners
- Tactic: The algorithm or rule used to select products for a slot
Quick Start
Here's a simple example to get product recommendations for a product detail page:
// Basic request to get recommendations for a product detail page
const getRecommendations = async (productId) => {
// Use the actual current URL from the browser
const params = new URLSearchParams({
currentUrl: window.location.href, // Use the actual current URL
refId: productId // Set product ID as refId parameter
});
const response = await fetch(
`https://<PA_END_POINT>/3.0/recommendations?${params.toString()}`,
{
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
}
}
);
const data = await response.json();
return data;
};
API Endpoint
Method: GET
URL: https://<PA_END_POINT>/3.0/recommendations
The Recommendations API is a RESTful HTTP API that uses standard HTTP methods and status codes. All requests should use HTTPS.
Next Steps
- See the Parameters Reference for all available query parameters
- Learn about the Response Schema returned by the API
- Check out the Examples for common implementation scenarios
- Review Best Practices for optimization tips