POST /asset/v1/content/assets/query

Gets an asset collection by advanced query.

JSON Parameters

queryobjectRequiredContains the actual search request, comprised of one or more simple queries. Combine multiple query objects into an advanced query using the logical operator AND or OR.
query.propertystringRefers to an element of the asset you are querying
query.simpleOperatorstringRepresents the comparison you are making between the property and the value
query.valuestringRepresents the data you are comparing the property for returning search results. The value can be practically any constant expression: a single word, a phrase or sentence, a number with our without decimals. When filtering for a property among multiple values, such as when using the in operator, the value field becomes values.
pageobjectContains page and pageSize. For page, start with 1 and continue until you get zero results. pageSize is the number of results per page to return.
sortobjectContains one or more properties to use for sorting, and also determines the direction in which to sort the data.
fieldsobjectList of asset properties used to reduce the size of your results to only the properties you need.

Sort Syntax

The sort syntax is the asset property name followed by the order direction, either asc or desc. This example sorts by both ID and version, in ascending and descending order, respectively.

Query Syntax

A complex query is comprised of two or more simple queries joined with an AND or OR logical comparison operator. The simple queries are contained in a leftOperand JSON field and rightOperand JSON field. A third field, the logicalOperator, is used to compare the two operands. You can also embed queries inside other queries.

Filter simpleOperators

equalCompares numbers and strings. Specifies that search results must contain an exact match of the words included in the search terms.
notEqualCompares numbers and strings.
lessThanCompares numbers only.
lessThanOrEqualCompares numbers only.
greaterThanCompares numbers only.
greaterThanOrEqualCompares numbers only.
likeIs similar to. Compares strings only.
containsCompares strings only. Specifies that search results must contain at least one of the words included in the search terms.
mustcontainSpecifies that search results must contain all words included in the search terms.
startsWithCompares strings only.
inValue is among the list of values. Use this operator to retrieve a list of assets by their IDs, or a list of assets by nearly any enumerable value.
whereValue is an exact match of the property's value. Compares only strings within enumerables, such as tags and attributes). Use this operator to query the tags and attributes list properties for assets where at least one item in the list matches your query.


Example Request

This example returns all assets whose version is 1 and assetType name is "Template"; returning the first 50 results, sorted by asset ID, ascending.

Example Response In addition to standard fields always returned on the asset object, the response contains any optional asset fields specified in the request.

200  A collection of assets
 CustomerKeystringReference to customer's private ID/name for the asset
 ContentTypestringThe type that the content attribute will be in
 DataobjectProperty bag containing the asset data
 AssetTypeobjectThe type of the asset saved as a name/ID pair
 VersionnumberThe version of the asset
 LockedbooleanSpecifies if the asset can be modified or not
 FilePropertiesobjectStores the different properties that this asset refers to if it is a file type
 NamestringName of the asset, set by the client. 200 character maximum.
 DescriptionstringDescription of the asset, set by the client
 CategoryobjectID of the category the asset belongs to
 TagsarrayList of tags associated with the asset
 ContentstringThe actual content of the asset
 DesignstringFallback for display when neither content nor supercontent are provided
 SuperContentstringContent that supersedes content in terms of display
 CustomFieldsobjectCustom fields within an asset
 ViewsobjectViews within an asset
 BlocksobjectBlocks within the asset
 MinBlocksnumberMinimum number of blocks within an asset
 MaxBlocksnumberMaximum number of blocks within an asset
 ChannelsobjectList of channels that are allowed to use this asset
 AllowedBlocksarrayList of blocks that are allowed in the asset
 SlotsobjectSlots within the asset
 BusinessUnitAvailabilityobjectA dictionary of member IDs that have been granted access to the asset
 sharingPropertiesobjectAllows you to share content with one or more business units that have Content Builder Sharing enabled. See Sharing for additional information.
 sharingProperties.sharedWithobjectList of MID IDs the asset is shared with
 sharingProperties.sharingTypestringIndicates the permission that you are granting to the list of MIDs in sharedWith. Possible values are view, edit, or local.
 TemplateobjectTemplate the asset follows
 FilestringBase64-encoded string of a file associated with an asset
 GenerateFromstringTells the sending compiler what view to use for generating this view's content
400  Bad request
 MessagestringThe error message
 ErrorCodenumberThe specific error code
 DocumentationstringAny specific documentation for the error
403  Permission error
 MessagestringThe error message
 ErrorCodenumberThe specific error code
 DocumentationstringAny specific documentation for the error

For more use cases related to this reference material, see Use Case Examples for Enhanced Content Search.

The Enhanced Content Search use cases show how the fictitious Northern Trail Outfitters company might use the Marketing Cloud Enhanced Content Search feature.