If you want to create collections of your favorite mediacontainers, use the new mediacontainer type “collection” and follow the next simple steps to create a collections and add items.
You can find more information regarding collections here https://developer.admiralcloud.com/collections/
Make sure to read the article https://developer.admiralcloud.com/how-to-use-this-platform/
Step 1: Create a mediaContainer of type collection
Use the following payload
let payload = {
type: 'collection',
subtype: 'favorite'
}
More Info: MediaContainer Controller
Step 2 – Add mediaContainers to this collection
Use the batch update call to add (pre-existing) mediaContainers to this collection.
Use the same payload with property remove = true on root level of the payload to remove mediaContainers from the collection.
let payload = {
updateParams: {
publicArea: {
publicAreaId: newCollection.id,
[settings: {
channelId: INTEGER, // optional
smartCropper: OBJECT // optional
}]
}
},
ids: [mediaContainer ids]
}
More Info: MediaContainer Controller
Step 3 – Search the collection
Use a search call to find collections. The “bool” object in the query payload is optional. You could also just send query as empty object.
The response will contain an array of mediaContainers of type “collection”. Every of this mediaContainers will have a property “relations” which is an array of objects.
Every object will contain a mediaContainerId – it is used in the next step.
let payload = {
types: ['collection'],
query: {
bool: {
filter: [
{ term: { subtype: 'favorite' }}
]
}
}
}
More Info: Search Controller
Step 4 – Retrieve the mediaContainers
In the last step, you retrieve the mediaContainers from a selected collection.
Use the mediaContainer ids from the search result (step 3).
let payload = {
field: 'ids',
searchTerm: [mediaContainerIds related to collection]
}
More Info: Search Controller