DC 5.8 Getting assets by other properties
URL: /digizuitecore/legacyservice/api/assets/search
Method: POST
Auth required: YES
Ā
The search API is extremely flexible in what it can search for, so this page only demonstrates a couple of examples to show the general structure of achieving different results.
You can only get the first 10.000 results by paging through the result using the skip
parameter. If you need more, you should use a cursor approach instead. The general trick in the cursor approach is to sort by asset id, then keep track of the last asset id you saw, and request all the assets with an asset id larger/smaller than that. This is very fast and allows you to get all results without missing anything in case the result set changes midway through. INSERT LINK HERE FOR EXAMPLE!!!
Ā
Request properties
Name | Type | Example | Description |
---|---|---|---|
sortBy | array of object | Ā | Specifies how you want results sorted. Multiple items can be passed in the array to specify sorting criteria in case 2 assets have the same value. |
sortBy.searchKey | string |
| The key of the search field you want to sort on |
sortBy.order | enum/string, one of
|
| The order you want results sorted in. |
facetFields | array of object | Ā | Specifies how you want to query for specific value, or how you want faceting results for a UI. |
facetFields.searchKey | string |
| The key of the search field you want to execute this facet on. |
facetFields.search | string |
| If you are requesting faceting for this field and not just filtering, then this can be used to search in the facet results instead, in case the value you are looking for is not in the top 10. |
facetFields.values | array of string |
| Will filter the assets in the result to include this value. Assets that doesnāt have this value will be excluded from the result set. |
facetFields.excluded | array of strings |
| Will filter the assets in the result to only include assets that doesnāt have this value. If both |
facetFields.operation | enum/string, one of
|
| If multiple |
facetFields.longRange | object | Ā | If the field you are faceting on is number-like, this can be used to search for assets with a value in the given range. |
facetFields.longRange.from | int64/long |
| All assets has to have a value greater than or equals to this. |
facetFields.longRange.to | int64/long |
| All assets has to have a value less than or equals to this. |
facetFields.doubleRange | object | Ā | If the field you are searching is a float field, this to be used to search for assets with a value in the given range. |
facetFields.doubleRange.from | double |
| All assets has to have a value greater than or equals to this. |
facetFields.doubleRange.to | double |
| All assets has to have a value less than or equals to this. |
facetFields.dateRange | object | Ā | If the field you are searching is a datetime field, this to be used to search for assets with a value in the given range. |
facetFields.dateRange.from | datetime |
| All assets has to have a value greater than or equals to this. |
facetFields.dateRange.to | datetime |
| All assets has to have a value less than or equals to this. |
facetFields.facetMode | enum/string, one of
| Ā | Used to control if facet values are calculated. If you donāt need to render facets in the UI, send |
facetFields.recursive | bool |
| If the field you are searching on is tree like, for example tree metafields or |
facetFields.missingValueHandling | enum/string, one of
| Ā | How to deal with assets without a value in the field.
Ā |
facetFields.doubleExactSearchRange | double |
| If |
facetFields.facetCounts | int |
| How many facet values to return when |
metaFieldItemGuids | array of string/guid/uuid |
| Additional metadata that should be included in the asset response. See Get Assets for more information. |
freeText | string |
| Freetext searches on assets. The specifc fields that will be searches on can be controlled using |
freeTextOnFields | array of string |
| The search keys of the fields to execute freetext search on. If not specified the system will search in all text-like fields. If the search value is a valid integer, then |
defaultFreeTextOperation | enum/string, one of
|
| If there is a space in the freetext query, does that imply |
count | int |
| How many assets to include in the result. |
skip | int |
| How many assets in the result to skip before returning. Can be used to implement paging. |
calculateTrueCount | bool |
| If you have more than 10000 matching assets in the result, you will get a total of |
Ā
Response properties
Name | Type | Description |
---|---|---|
errorCode | int | The status code in case something went wrong. |
errorMessage | string | An error message in case something wenāt wrong. |
hasError | bool | If something went wrong, this will be true. |
items | array of objects | |
total | int | The number of assets that matches the search. |
totalRelation | enum/string, one of
| Is the |
facets | array of object | Any facetRequest fields that have FacetMode=Facet will be returned here. Again the |
facets.searchKey | string | The searchkey that was passed in the request. Use it to map between request and response. |
facets.fieldName | string | The display name of this search field. |
facets.buckets | list of objects | Each bucket is a āfacet valueā. |
facets.buckets.key | string | The value to pass in |
facets.buckets.count | int | How many assets has this value. |
facets.buckets.label | string/null | A text value to display for this bucket. |
facets.buckets.valueObject | object | A details object for this value. For combo value fields this will be the combo value itself. For tree fields the tree value. For ItemReference field this is the item. |
facets.min | long/double/datetime/null | The minimum value that occurs for all the assets matching the search. |
facets.max | long/double/datetime/null | The maximum value that occurs for all the assets matching the search. |
trueTotal | int | If |
Ā
Ā
Ā
Ā
Ā
Ā
Ā