Searching content
The Search API is used to fetch content with natural language queries. This API allows developers to build search into their applications without the need of using a 3rd-party service. When content is published, Type CMS automatically indexes the content and makes it available immediately through the Search API. This API is read-only and authorization is granted via project tokens that are attached to environments.
With the Search API, you can combine text queries with body parameters to filter entries by, similar the Content API.
post
Fetches entries that match the provided search query in the URL. Results are sorted by relevance but can be sorted by any field in an entry using the sort parameter in your post body.
Required attributes
projectId | string | Your project ID |
query | string | The query parameter to set in the URL |
Optional attributes
format | string | Must be "html" or null. Converts RTE content to HTML for you |
limit | number | Limits the number of entries returned |
skip | number | For pagination, the number of entries to skip |
sort | object | The field to sort on. For example, { createdAt: -1 } will sort results by publish datetime desc. |
Request
post
/api/projects/:projectId/content/search?query=:query
Response
Last modified 7/6/2024, 5:26:18 PM