We released a new version of the JavaScript API client in public beta.
Read the beta documentation for more information.
We released a new version of the PHP API client in public beta.
Read the beta documentation for more information.
We released a new version of the Java API client in public beta.
Read the beta documentation for more information.
Install
The Algolia Recommend client is separate from the search client.
You can install it from npm.
1
| npm install @algolia/recommend
|
If you don’t use a package manager, you can include this snippet in your HTML:
1
2
3
4
| <script src="https://cdn.jsdelivr.net/npm/@algolia/recommend"></script>
<script>
const algoliarecommend = window['@algolia/recommend'];
</script>
|
Initialize the client
1
2
3
4
5
6
7
| <?php
// Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
require_once __DIR__."/vendor/autoload.php"
use Algolia\AlgoliaSearch\RecommendClient;
$client = RecommendClient::create('YourApplicationID', 'YourSearchOnlyAPIKey');
|
1
2
3
4
5
6
7
| # Installation instructions:
# https://www.algolia.com/doc/api-client/getting-started/install/
require 'algolia'
client = Algolia::Recommend::Client.create(
'YourApplicationID', 'YourSearchOnlyAPIKey'
)
|
1
2
3
4
5
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
const algoliarecommend = require('@algolia/recommend');
const client = algoliarecommend('YourApplicationID', 'YourSearchOnlyAPIKey');
|
1
2
3
4
5
| # Installation instructions:
# https://www.algolia.com/doc/api-client/getting-started/install/
from algoliasearch.recommend_client import RecommendClient
client = RecommendClient.create("YourApplicationID", "YourSearchOnlyAPIKey")
|
1
2
3
4
5
6
7
8
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import AlgoliaSearchClient
let client = RecommendClient(
appID: "YourApplicationID",
apiKey: "YourSearchOnlyAPIKey"),
)
|
1
2
3
4
5
6
7
8
9
10
11
12
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import com.algolia.search.model.APIKey
import com.algolia.search.model.ApplicationID
import com.algolia.search.client.ClientRecommend
suspend fun main() {
val client = ClientRecommend(
applicationID = ApplicationID("YourApplicationID"),
apiKey = APIKey("YourSearchOnlyAPIKey"),
)
}
|
1
2
3
4
5
6
7
8
9
10
11
12
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
using Algolia.Search.Clients;
class Program {
public static void Main(string[] args) {
var client = new RecommendClient(
"YourApplicationID",
"YourSearchOnlyAPIKey"
);
}
}
|
1
2
3
4
5
6
7
8
9
10
11
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
import com.algolia.search.DefaultRecommendClient;
import com.algolia.search.RecommendClient;
public class Program {
public static void main(String[] args) {
RecommendClient client = DefaultRecommendClient.create(
"YourApplicationID", "YourSearchOnlyAPIKey");
}
}
|
1
2
3
4
5
6
7
8
9
10
11
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
package main
import (
"github.com/algolia/algoliasearch-client-go/v3/algolia/recommend"
)
func main() {
client := recommend.NewClient("YourApplicationID", "YourSearchOnlyAPIKey")
}
|
1
2
3
4
5
| // Installation instructions:
// https://www.algolia.com/doc/api-client/getting-started/install/
// Use the same client as for search
val client = new AlgoliaClient("YourApplicationID", "YourSearchOnlyAPIKey")
|