Re: Fetch all Programs inside a Folder

Anonymous
Not applicable

How do we fetch the list of Programs which are associated with a Folder?

Tags (2)
10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

This is an explicit filter type for the Programs API. Are you reading the docs?

Anonymous
Not applicable

Hi Stanford, as per API description for Programs, we can query based on Name,ID,tag and browsing based on filter. I am not able to fetch the list of programs based on Folder Name of Id. Please let me know if i am missing anything here.

SanfordWhiteman
Level 10 - Community Moderator

... and what are those filter types again?

Anonymous
Not applicable

Regarding Program Browsing, filter only applies to Engagement and Email programs.  The possible values are “on” and “off” for Engagement programs, and “unlocked” for Email programs. So, where do we mention the Folder Name or Id?

SanfordWhiteman
Level 10 - Community Moderator

filterType=folderId

Anonymous
Not applicable

I tried fetching programs with below url :

https://113-EDC-810.mktorest.com/rest/asset/v1/programs.json?maxReturn=200&folderId=262

But in response, i am seeing the programs associated with different folderId as well like below :

{

      "id": 1444,

      "name": "0 - Empowered Retail Nurture",

      "description": "",

      "createdAt": "2015-11-16T22:41:44Z+0000",

      "updatedAt": "2015-11-16T22:50:11Z+0000",

      "url": "https://app-ab11.marketo.com/#NP1444A1",

      "type": "Engagement",

      "channel": "Nurture",

      "folder": {

        "type": "Folder",

        "value": 1129,

        "folderName": "Empowered by Digital - Retail"

      },

      "status": "on",

      "workspace": "2nd Workspace"

    },

Please let me know what param i am missing here?

Thanks in Advance

SanfordWhiteman
Level 10 - Community Moderator

I gave you the param and you didn't include it.

Anonymous
Not applicable
Javier_Sanchez1
Level 2

May I hijack the thread and dive deeper?

what if

?maxReturn=200&filterType=folderId&filterValues=141&earliestUpdatedAt=2018-01-01T00:00:00-05:00

returns more than 200 records?

how do i fetch all the records?

campaigns.json have "nextpagetoken" in the result and it is possible to iterate over that.

I have a feeling that for programs "offset" parameter might do the trick, but can't really figure out how to properly use it.

Please somebody post an example.

Javier_Sanchez1
Level 2

nevermind. guess i figured it out already.

it appears it is like offset in mysql select. (ignore first n records and return the rest)

so the usage would be:

?maxReturn=200&filterType=folderId&filterValues=141&earliestUpdatedAt=2018-01-01T00:00:00-05:00&offset=0

count = len(response_json["result"])

if count =200 then offset+200 and repeat.