Initializing the SDK with your API key and configuration options creates a client instance for making search, recommendation, and feedback requests. Configuration parameters like request method, timeout duration, and retry count enable you to customize SDK behavior to match your technical requirements and performance needs.
The SDK supports both JSONP and POST request methods along with optional user objects for personalization, providing flexibility in how you integrate platform features while maintaining consistent user tracking. This helps ensure you can implement search and recommendations in ways that align with your application architecture.
Initializes library.
Arguments:
config.key required (string): Merchant API key.
config.user optional (user): User object. Could be provided either at initialization or at request.
config.method optional ('jsonp' || 'post'): Request method. Default 'jsonp'.
config.log optional (boolean): Defines, should Findify log requests on server.
config.url optional (string): Search API url. Used to overwrite the default Search API url.
config.timeout optional (number): Request timeout duration. Defaults to 5000ms.
config.retryCount optional (number): Retry count before rqeuest fails. Defaults to 3.
config.jsonpCallback optional (string): JSONP callback function name. It is required for method: 'jsonp' parameter.
Types:
user.uid required (string): Unique customer id.
user.sid required (string): Session id.
user.email optional (string): Customer email.
user.ip optional (number): Customer ip.
user.ua optional (string): Customer user agent.
user.lang optional (string[]): Languages.
Returns:
Client instance, which could be used further for sending requests to the server.
Examples of usage:
var client = FindifySDK.init({
method: 'post',
key: 'b9h348b89h439g43',
user: {
uid: 'f892hf2938f2g9p2',
sid: 'g2984hg2jg9823g9',
}
});
// After, you can send requests to server:
client.send(request).then(function (response) {
// handle response
});
Related Articles
Integration & Setup:
Search & Discovery:
Product Recommendations: