POST /asset/v1/content/assets/query
Use an advanced query to retrieve a collection of assets.
An advanced asset query has the properties listed in this table.
Name | Type | Description |
---|---|---|
fields | Fields array | An array that specifies the fields to return in the response. |
page | Page Object | An object that controls the page number and page size. |
query | Query Object | Required. An object that contains simple queries that are united by using AND or OR logic. |
sort | Sort Array | An object that specifies how to sort the items in the response. |
The fields
array is an array of strings. Each string in the array corresponds to an asset field. The response to an advanced query includes information about the fields that you specify in this array.
Use the page
object to paginate and navigate large result sets. The page
object contains the properties in this table.
Name | Type | Description |
---|---|---|
page | Integer | The page number of results to be returned in the response. The default value is 1 . |
pageSize | Integer | The number of results to be returned on each page. The default value is 50 . |
The query
object contains two simple queries that are contained in leftOperand
and rightOperand
objects. These operands are connected by the logicalOperator
property. You can also embed queries within other queries.
The value of the logicalOperator
property can be either AND
or OR
.
The leftOperand
and rightOperand
objects have the properties listed in this table.
Name | Type | Description |
---|---|---|
property | String | The name of the field to use in the comparison. |
simpleOperator | String | The comparison operator to use in the query. Possible values are:
|
value | String, number, boolean, or array | The value to compare the specified field to. |
In queries where the value of property
is content
and the value of simpleOperator
is equal
, the property
field can contain a minimum of 3 characters and a maximum of 6 characters. This restriction does not apply to any other values of the property
field.
The sort
array is an array of objects. Each object in the array specifies a method of sorting the result set. You can sort on multiple properties. When you specify multiple sort rules in this array, the API applies the rules in the order that they’re listed in the array, from top to bottom.
Each object in the sort array contains the properties listed in this table.
Name | Type | Description |
---|---|---|
property | String | The name of the field to sort on. |
direction | String | The sort direction for the specified property. Possible values are ASC (to sort results in ascending order) and DESC (to sort in descending order). |
This example returns all assets whose version is 2
and assetType.name
is Template
, returning the first 50
results, sorted by asset id
in ascending order.
In addition to standard fields always returned on the asset object, the response contains all optional asset fields specified in the request.
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
.
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. |