Links
🗂

Get Collections

Use this method to get metadata of multiple collections at the same time.

Usage in your script

JavaScript
TypeScript
const response = await altura.getCollections();
​
// customize options
const response = await altura.getCollections({
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc'
});
​
// filter documents by any properties
const response = await altura.getCollections(
{}, // Default pagination
{
isVerified: true
} // fetching verified collections only
);
​
const collections = response.collections;
const collectionCount = response.count;
const response: { collections: IAlturaCollection[], count: number } = await altura.getCollections();
​
// customize options
const response: { collections: IAlturaCollection[], count: number } = await altura.getCollections({
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc'
});
​
// filter documents by any properties
const response: { collections: IAlturaCollection[], count: number } = await altura.getCollections(
{}, // Default pagination
{
isVerified: true
} // fetching verified collections only
);
​
const collections = response.collections;
const collectionCount = response.count;

Parameters

Parameter
Type
Required
Description
perPage
number
Optional
The number of collections to return
page
number
Optional
The offset for returned collections. Calculated as (page - 1) * perPage
sortBy
String
Optional
The field to sort the collections by (any field in the collection schema may be used)
sortDir
"asc" | "desc"
Optional
Choose to sort in ascending (asc) or descending (desc) order