I am trying to retrieve the folders in bulk using the following API:
But no matter what I give the maxDepth (greater than 2), the maximum number of folders in the result never exceeds 20, i.e. does not return all the folders to the given depth.
Is this the limitation of API?
Solved! Go to Solution.
Read here: http://developers.marketo.com/rest-api/paging-tokens/ under Position-Based.
So, in your request are you getting a nextPageToken value? If you do, you have to create an additional request adding nextPageToken=valueReceived, so you will get the next 20 folders.
You are right, by adding maxReturn=200, it increases the returned folders on the request.
This should be added to the documentation. Do you mind sending a feedback clicking on the bottom link on this page: http://developers.marketo.com/rest-api/assets/folders/
Also, would be nice to know in that same documentation the maximum number allowed for maxDepth parameter.
I have two more questions related to this:
1. What if I want more folders to be fetched? I didn't find any nextPageToken even after adding maxReturn=200
2. Can we have a filter on the folderType to fetch the directory structure? (Eg: Fetch only folders of type 'Program')
1. Use offset for these APIs, not nextPageToken.
2. I don't think there's a direct filter here, but you can use the Programs API in concert with the Folders API to build out what you want.