Introduction to Cludo API: Setup, Search, and Indexing
Cludo’s API implementation offers a flexible and customizable approach to integrating advanced search functionalities into your website or application. This guide provides a detailed overview of setting up Cludo’s API on the customer side.
How do our API’s work?
Cludo offers a powerful set of APIs designed to give you full flexibility in integrating and managing your search experience. Whether you’re building a custom frontend search interface or managing content behind the scenes, our APIs provide the tools you need.
Building Search Experiences
To set up and customize the search functionality on your website or application, you will use Cludo’s search engine endpoints. This includes capabilities such as performing search queries, applying filters, handling pagination, and more.
These features are supported through Version 3 of the API, which provides all the necessary endpoints for retrieving and displaying search results. Version 3 is recommended if you are developing a custom search interface using a frontend framework or if you want full control over the design and behavior of the search experience.
V3 – Legacy Content API Documentation
Managing Search Content
To control what content is indexed and how it appears in search results, Cludo provides two key APIs under Version 4 (V4):
- Crawler API: Trigger on-demand crawls of specific URLs to ensure timely updates, which are ideal for news, events, or product launches that need fast indexing.
- Index API: Push structured content directly into your search index. Define titles, descriptions, URLs, and custom metadata for full control over content representation.
V4 – Content API Documentation (Crawler and Index API)
V4 is our current standard for managing and maintaining your search index. This version only covers the Crawler API and Index API. For search-related functionality, please refer to the Version 3 documentation.
Prerequisites
Before initiating the API integration, ensure you have the following:
- Customer ID and Engine ID: These identifiers are essential for API requests. You can find them in MyCludo under Configuration > API.
- API Key or Site Key: Used for authenticating your requests.
- API Hostname: Corresponds to your account’s region (e.g., api-us1.cludo.com). This information is also available in the API in MyCludo.
Authentication Methods
Cludo supports two primary authentication methods:
1. Site Key Authentication
Designed for public-facing search functionalities, this method prevents the exposure of your API key. The credentials must be Base64-encoded in the following format:
Authorization: SiteKey <Base64-encoded string>
Where the Base64-encoded string represents:
<Customer ID>:<Engine ID>:SearchKey
This method is suitable when you want to embed search functionalities directly into your website without compromising security.
2. Basic Authentication
Utilized for administrative tasks such as managing content or accessing analytics. This method requires your customer ID as the username and the API key as the password. This is typically used in server-to-server communications where the API key can be securely stored.
Setting Up Search Functionality
To implement search using Cludo’s API:
- Construct Search Requests: Use the appropriate endpoint (e.g., /api/v3/search) with necessary parameters such as query terms, filters, and pagination details.
- Handle Search Responses: Parse the JOSN or HTML responses to display relevant search results on your website.
- Implement Autocomplete: Utilize the autocomplete endpoint to provide real-time search suggestions as users type their queries.
Detailed documentation and examples are available in Cludo’s V3 Documentation here.
Implementing Analytics Tracking
To monitor and analyze search behavior, you can use one of the following methods:
- Include Cludo’s API Analytics Script Add the provided JavaScript snippet to your search results page. Learn more in this article.
- Configure Data Attributes Ensure your HTML elements include the necessary data attributes for tracking queries and clicks.
- You can also use the query and clicklog endpoints to track user search queries and interactions programmatically.