1. Home
  2. Docs
  3. AI Related Products Docum...
  4. API

API

AI Related Products comes with an API to extend your data to your associated apps and other digital platforms. You can target your loyal customers by offering them with the products that fascinate them through your apps, emails and other means by the help of API. This feature is only available in the Pro Version.

Base API URL
https://your-website-domain.com/wp-json/stwairp/v1/products?

Attributes you need to pass in API URL

Customer ID: user_id=23
Data to pass is number.
Pass the user ID of your loyal customer. If the user ID is not valid, the result will be random products.

Include Cart Products For Reference (optional) : cart_ref=1
Data to pass is boolean. (pass 0 or 1, the default is 0)
Include items from the shopping cart to filter the related products.

Number of Products (optional) : no_of_products=8
Data to pass is number. The default is 6.
Pass the number of products you want to fetch

Number of Recently Ordered Products (optional) : order_ref=1
Data to pass is number. The default is 0.
Pass 1 as a reference to filter products by most recently ordered/purchased item, 2 for two most recently ordered/purchased items, and so on. For all ordered/purchased items, set 0.

Additional Meta Filters (optional) : meta_filter=sale
Data to pass is string. (Limited Options: none, sale, featured and best-selling, the default is none)
Further, filter the products by choosing only those that are on sale, featured, or are the best-selling.

Final API URL
https://your-website-domain.com/wp-json/stwairp/v1/products?user_id=23&cart_ref=1&no_of_products=8&order_ref=1&meta_filter=sale

Data Fetched
1. Product ID (data type: integer)
2. Product title (data type: string)
3. Product link (data type: URL)
4. Product featured image link (data type: URL)
5. Product Rating (data type: HTML)
6. Product Price (data type: HTML)
7. Product on Sale (data type: boolean)