Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Search result

Search for results

Returns a list of search results matching your query.

By default, it returns 20 results. You can paginate the results using limit and offset parameters. In any case, a maximum number of 100 results is returned.

Query parameters

filter object

Attributes to filter search results

query string

Text to search

Example: "florence apartments"
fuzzy boolean

When any value is passed, it enables the fuzzy search: the Levenshtein Edit Distance is used to match more results.

build_trigger_id string

The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project

Example: "44"
locale string

Restrict the search on pages in a specific locale

Example: "it"
page object

Parameters to control offset-based pagination

offset integer

The (zero-based) offset of the first entity returned in the collection (defaults to 0)

Example: 200
limit integer

The maximum number of entities to return (defaults to 20, maximum is 100)

Returns

Returns an array of resource objects of type search_result.

Examples

1
GET https://site-api.datocms.com/search-results?filter=%5Bobject+Object%5D HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
Terminal window
1
curl -g 'https://site-api.datocms.com/search-results?filter=%5Bobject+Object%5D' \
2
\
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3"
1
await fetch(
2
"https://site-api.datocms.com/search-results?filter=%5Bobject+Object%5D",
3
{
4
headers: {
5
Authorization: "Bearer YOUR-API-TOKEN",
6
Accept: "application/json",
7
"X-Api-Version": "3",
8
},
9
},
10
);
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
Cache-Control: cache-control: max-age=0, private, must-revalidate
4
X-RateLimit-Limit: 30
5
X-RateLimit-Remaining: 28
6
7
{
8
"data": [
9
{
10
"type": "search_result",
11
"id": "12adNIIB8rFJF1DoTgCk",
12
"attributes": {
13
"title": "Florence Apartments for Rent | Long Term Student Accommodation Rentals",
14
"body_excerpt": "Finding a place to live while planning to study abroad in Florence can be both exciting and challenging. With this in mind, Housing in Florence assists you in finding conveniently-located housing based...",
15
"url": "http://www.website.com/some-page",
16
"score": 11.3,
17
"highlight": {}
18
}
19
}
20
],
21
"meta": {
22
"total_count": 20
23
}
24
}