Sep 24, 2024
Recommend API client
The Recommend API client is part of the algoliasearch
package.
To install this package, run:
Copy
1
npm install algoliasearch
To use the Recommend client:
Copy
1
2
3
4
import { algoliasearch } from "algoliasearch";
const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const recommendClient = client.initRecommend();
The algoliasearch
package includes API clients for the Search, Recommend, Analytics, A/B testing, and Personalization API.
If you just want to use the Recommend API client, you can install its package on its own:
Copy
1
npm install @algolia/recommend
To use it, run:
Copy
1
2
3
4
5
6
import { recommendClient } from "@algolia/recommend";
const client = recommendClient(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY"
);
If you just want to retrieve recommendations,
but don’t need to manage Rules,
you can use the liteClient
:
Copy
1
2
3
import { liteClient } from "algoliasearch/lite";
const client = liteClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
List of methods
Each method makes one request to the Recommend API.
Recommendations
client.getRecommendations | Retrieve recommendations |
Rules
client.getRecommendRule | Retrieve a rule |
client.deleteRecommendRule | Delete a rule |
client.getRecommendStatus | Check task status |
client.searchRecommendRules | Search for rules |
client.batchRecommendRules | Create or update a batch of Recommend Rules |
Did you find this page helpful?