Currently this functionality is only available on the Staging API.
This section provides you with the tools to efficiently manage and retrieve collectibles data. Here's a brief overview of what you'll find:
Basic Filtering: Filter collectibles based on ownership and collection criteria, allowing you to retrieve items owned by specific users or belonging to particular collections.
Comparative Filtering: Advanced filtering techniques, including direct equal comparisons, range-based queries, and text searches, to narrow down your results more precisely.
Pagination: Handle large datasets effectively by implementing pagination, ensuring a smooth and responsive user experience even when dealing with extensive amounts of collectibles data.
Basic Filtering
Filter Collectibles owned by a user and collection
A list of collection IDs to filter assets on the addresses provided.
e.g.
[
"7672:root:1234",
"7672:root:2341",
]
Since both the above properties are optional you can use the independently or together based on the use case. For example filtering using addresses and collectionIds will return all the collectibles in the specified collections owned by the addresses.
In addition to address and collection-based filtering, further filtering can be done using a direct equal comparison of values, values that fit in a specified range or even a direct text search.
Filter Types
Equal
The name property is used to target the correct item to filter. The equal filter must take a string property as the value, even if the targeted property is a number.
The name property is used to target the correct item to filter. The range filter will take an array of up to two numbers, with the first number being the minimum value and the second number being the maximum value with both numbers being included.
The search filter simply takes a string value to search across all the properties and attributes in the metadata.
"search": "Freedom"
Filter Targeting
In the above examples you may have noticed the use of the . to target specific items. Since we separate properties and attributes (commonly known as traits in NFT metadata) we need to target them specifically in our filters.
By traits (aliased as attributes)
Filter through the attributes
e.g. attributes.Fur Colour, attributes.Age
By properties
Filter through properties on the metadata
e.g. properties.name
An example of a filter expression will look like the following for the above trait and property filters when put together: