POST /asset/v1/content/assets/query
Get several assets by query.
Get an asset collection by advanced query.
Name | Type | Description |
---|---|---|
query | object | Required. Contains 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.property | string | Refers to an element of the asset you are querying. |
query.simpleOperator | string | Represents the comparison you are making between the property and the value. |
query.value | string | Represents the data you are comparing the property for returning search results. The value can be practically any constant expression:
in operator, the value field becomes values . |
page | object | Contains 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. |
sort | object | Contains one or more properties to use for sorting, and also determines the direction in which to sort the data. |
fields | object | List of asset properties used to reduce the size of your results to only the properties you need. |
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.
A complex query is composed 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.
Operator | Description |
---|---|
equal | Compares numbers and strings. Specifies that search results must contain an exact match of the words included in the search terms. |
notEqual | Compares numbers and strings. |
lessThan | Compares numbers only. |
lessThanOrEqual | Compares numbers only. |
greaterThan | Compares numbers only. |
greaterThanOrEqual | Compares numbers only. |
like | Compares strings only. Specifies that search term must be similar to, but not necessarily a proper substring of, search results. |
isNull | |
isNotNull | |
contains | Compares strings only. Specifies that search results must contain at least one of the words included in the search terms. |
mustcontain | Specifies that search results must contain all words included in the search terms. |
startsWith | Compares strings only. |
in | Value 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. |
where | Value 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 2
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.
Query for Archived Assets
You can query for archived assets by including a filter for the asset's status.name
or id
value.
Modify the first example request to replace the leftOperand
with a filter that includes the asset's status.name
of Archived
, as shown here.
The response contains a collection of zero or more archived assets of asset type Template
.
Status | Name | Type | Description |
---|---|---|---|
200 | A collection of assets | ||
CustomerKey | string | Reference to customer's private ID/name for the asset. | |
ContentType | string | The type that the Content attribute is in. | |
Data | object | Container for asset properties. | |
AssetType | object | The type of the asset saved as a name/ID pair. | |
Version | number | The version of the asset. | |
Locked | boolean | Specifies whether the asset can be modified. | |
FileProperties | object | Stores the different properties that this asset refers to if it is a file type. | |
Name | string | Name of the asset, set by the client. 200 character maximum. | |
Description | string | Description of the asset, set by the client. | |
Category | object | ID of the category the asset belongs to. | |
Tags | array | List of tags associated with the asset. | |
Content | string | The actual content of the asset. | |
Design | string | Fallback for display when both Content and Supercontent are not provided. | |
SuperContent | string | Content that supersedes Content in terms of display. | |
CustomFields | object | Custom fields within an asset. | |
Views | object | Views within an asset. | |
Blocks | object | Blocks within the asset. | |
MinBlocks | number | Minimum number of blocks within an asset. | |
MaxBlocks | number | Maximum number of blocks within an asset. | |
Channels | object | List of channels allowed to use this asset. | |
AllowedBlocks | array | List of blocks allowed in the asset. | |
Slots | object | Slots within the asset. | |
BusinessUnitAvailability | object | A dictionary of member IDs granted access to the asset. | |
sharingProperties | object | Allows you to share content with one or more business units having Content Builder Sharing enabled. See Sharing for additional information. | |
sharingProperties.sharedWith | object | List of MID IDs with which the asset is shared. | |
sharingProperties.sharingType | string | Indicates the permission that you are granting to the list of MIDs in sharedWith . Possible values are
| |
Template | object | Template that the asset follows. | |
File | string | Base64-encoded string of a file associated with an asset. | |
GenerateFrom | string | Tells the sending compiler what view to use for generating this view's content. | |
400 | Bad request | ||
Message | string | The error message. | |
ErrorCode | number | The specific error code. | |
Documentation | string | Any specific documentation for the error. | |
403 | Permission error | ||
Message | string | The error message. | |
ErrorCode | number | The specific error code. | |
Documentation | string | Any 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 uses the Marketing Cloud enhanced content search feature.