[ARCHIVED] Arc Media List through API

Jump to solution
shriram_manohar
Community Novice

Hi,

In the ARC media library API documentation , there is no API to fetch the list of media in a collection. What is the way to get all media items in a collection through API?

Regards,

Shriram

Labels (1)
1 Solution
James
Community Champion

This sounds like a pagination issue. If you scroll to the bottom of the page, it mentions the per_page parameter. There is also a page parameter.

per_page: The number of results per page. Default: 20, Max: 50

page: The page to retrieve. Default: 1

When you get the first perspective result, there is some meta data that lets you know the total. In the example below, I made the default call, so I got 20 perspectives. 

296355_pastedImage_1.png

The last page is 5, so I could make the following calls to get all of the data (my collection ID was 342). The first one was the original call.

/api/media_management/collections/342/perspectives
/api/media_management/collections/342/perspectives?page=2
/api/media_management/collections/342/perspectives?page=3
/api/media_management/collections/342/perspectives?page=4
/api/media_management/collections/342/perspectives?page=5

Alternatively, if I specified per_page=50, then I get this result

296356_pastedImage_1.png

In this case, I could get all of the information in just two calls.

/api/media_management/collections/342/perspectives?per_page=50
/api/media_management/collections/342/perspectives?per_page=50&page=2

View solution in original post