SearchAfter API (V3)
Use the SearchAfter API (V3) to fetch multiple pages of search results sequentially with SearchAfterRequest.
Access the OpenAPI definition of the latest version of the Querying API.
Version 3.0 uses LoadConfiguration to handle how relations are serialized in response payloads. This is a change from Version 2.0, which used Renditions and NestedRelations instead.
Not all search results are kept in memory. To have consistent search results between pages, add at least one query parameter that is unique and easily sortable, for example, an identifier. Using a modification date might return inconsistent results if new entities are modified while navigating between pages in the same search result set.
This endpoint is available at the following URL:
POST http://<HOSTNAME>/api/entities/searchafter/
You must set the X-ApiVersion header to 3.
You cannot use LINQ to build queries with the SearchAfter API. However, here are some examples to help you use this API to filter results.
Paginate results
To paginate results, use the search_after field and do the following:
-
Create and apply a filter. This retrieves the first page of results. The size of the first page is determined by the
Takeparameter in the filter. -
Note the value in the
last_hit_datafield in the results. For example:RequestResponse"last_hit_data": [ "1711962952348" ], -
Use the same filter as in step 1 and include a value, for example:
"search_After": ["1711962952348"].The
last_hit_datachanges after every request, so you need to update it in subsequent searches.
Filters
The following filters are supported:
Supported operators
The following comparison operators are supported dependent on the property data type:
You can use any of the supported operators in your query.
|
Data type |
Operators |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String properties support some additional filters:
-
Contains- this value must contain the specified substring. -
StartsWith-this value must start with the specified substring. -
EndsWith- this value must end with the specified substring.
Request
A request includes the following parameters:
-
Filter- defines the criteria for the search. In this case, it filters assets by their definition name, such asM.Asset. -
Take- specifies the number of results to retrieve per request. -
Sorting- orders results by a field (such asidentifier) in ascending order. -
Search_after- uses the value from the last result to fetch the next set of results. -
LoadConfiguration- specifies which properties, cultures, and relations to load. For example, custom settings allow specific properties likeTitleand relations likeAssetTypeToAssetto be loaded.
{
"filter": {
"name": "M.Asset",
"type": "DefinitionName"
},
"take": 25,
"sorting": [
{
"field": "identifier",
"order": "Asc"
}
],
"search_after": null,
"load_configuration": {
"culture_option": {
"load_option": "None"
},
"property_option": {
"load_option": "Custom",
"properties": ["Title"]
},
"relation_option": {
"load_option": "Custom",
"relations": [
{ "name": "AssetTypeToAsset" }
]
}
}
}Response
A response returns an EntityCollectionResource object and can include the following parameters:
-
Last_hit_data- holds the identifier of the last item in the current page, used to retrieve the next page of results. -
Items- contains the entities retrieved, with their properties, relations, and metadata likecreated_by,modified_on,permissions, andrenditions. -
TotalItems/ReturnedItems- displays the total number of items that match the query and the number of items returned in the current response.
{
"last_hit_data": [
"asset.11154snackingindulgent"
],
"items": [
{
"id": 34994,
"identifier": "asset.11154SnackingIndulgent",
"cultures": [],
"properties": {
"Title": "Snacking: indulgent or essential to a healthy diet",
"FileName": "11154-Snacking-Indulgent-or-Essential-to-a-healthy-diet.pdf"
},
"relations": {
"AssetTypeToAsset": {
"parent": {
"href": "https://localhost:8180/api/entities/34623"
},
"self": {
"href": "https://localhost:8180/api/entities/34994/relations/AssetTypeToAsset"
}
}
},
"created_by": {
"href": "https://localhost:8180/api/entities/6",
"title": "The user who created the entity"
},
"created_on": "2024-10-14T19:19:20.7721363Z",
"modified_by": {
"href": "https://localhost:8180/api/entities/6",
"title": "The user who last modified the entity"
},
"modified_on": "2024-10-14T19:33:17.361439Z",
"entitydefinition": {
"href": "https://localhost:8180/api/entitydefinitions/M.Asset",
"title": "The entity definition for this entity"
},
"copy": {
"href": "https://localhost:8180/api/entities/34994/copy",
"title": "Copy this entity"
},
"permissions": {
"href": "https://localhost:8180/api/entities/34994/permissions",
"title": "The permissions on this entity"
},
"lifecycle": {
"href": "https://localhost:8180/api/entities/34994/lifecycle",
"title": "The lifecycle action for this entity."
},
"saved_selections": {
"href": "https://localhost:8180/api/entities/34994/savedselections",
"title": "The saved selections this entity belongs to"
},
"roles": {
"href": "https://localhost:8180/api/entities/34994/roles",
"title": "Roles for this entity"
},
"annotations": {
"href": "https://localhost:8180/api/entities/34994/annotations",
"title": "Annotations for this entity"
},
"is_root_taxonomy_item": false,
"is_path_root": true,
"inherits_security": true,
"is_system_owned": false,
"version": 4,
"self": {
"href": "https://localhost:8180/api/entities/34994"
},
"related_paths": {
"AssetTypeToAsset": [
[
{
"values": {
"en-US": "Social Media Asset"
},
"entity": "https://localhost:8180/api/entities/34623",
"definition": "https://localhost:8180/api/entitydefinitions/M.AssetType"
}
]
]
},
"renditions": {
"downloadOriginal": [
{
"href": "https://localhost:5009/api/delivery/local-6c8a7bc9c26c4f95a8c6451c0384e3f2?intent=Download&expires=2024-10-14T19%3A55%3A10.2949693%2B00%3A00&entityid=34994&userid=6&rendition=downloadOriginal&signature=pLKt5ST6Qok"
}
],
"downloadAlternative": [
{
"href": "https://localhost:5009/api/delivery/local-6c8a7bc9c26c4f95a8c6451c0384e3f2?intent=Download&expires=2024-10-14T19%3A55%3A10.2980889%2B00%3A00&entityid=34994&userid=6&rendition=downloadAlternative&signature=7RTHFkWHc0s"
}
]
}
}
],
"total_items": 249,
"returned_items": 1
}If relation load options are set to None, all relations are returned as a link. For example:
"AssetTypeToAsset": {
"self": {
"href": "https://localhost:8180/api/entities/12345/relations/AssetTypeToAsset"
}
}Otherwise, it is returned as a relation link. For example:
"AssetTypeToAsset": {
"parent": {
"href": "https://localhost:8180/api/entities/34623"
},
"self": {
"href": "https://localhost:8180/api/entities/34994/relations/AssetTypeToAsset"
}
}