SOLVED

Re: API call to fetch Sub-programs in an Engagement program

Go to solution
jmohan05
Level 1

API call to fetch Sub-programs in an Engagement program

Hi Experts,

 

We have a requirement to fetch the Program details of the Parent program and it's Sub-program. 

Here the parent program is an engagement program and sub-program is an event program. 

 

Can anyone suggest the API path for this requirement.

 

jmohan05_0-1648461302219.png

 

https://{{ev_hostname}}/rest/asset/v1/program/byName.json?name=Nurture_Program_J returns only the Parent program details (Nurture_Program_J). We would also need details of sub programs present under parent program,

 

Thanks,

JMohan

 

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: API call to fetch Sub-programs in an Engagement program

Hi JMohan!

Can you try using the browse programs endpoint with filterType = programId and filterVaules = <Engagement Program's id> query parameters? The endpoint should look something like below:

 

https://123-XYZ-123.mktorest.com/rest/asset/v1/programs.json?access_token=<access-token>&filterType=programId&filterValues=<engagement program id>

 

This endpoint should return all the programs' data created as nested programs within the EP.

View solution in original post

3 REPLIES 3
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: API call to fetch Sub-programs in an Engagement program

Hi JMohan!

Can you try using the browse programs endpoint with filterType = programId and filterVaules = <Engagement Program's id> query parameters? The endpoint should look something like below:

 

https://123-XYZ-123.mktorest.com/rest/asset/v1/programs.json?access_token=<access-token>&filterType=programId&filterValues=<engagement program id>

 

This endpoint should return all the programs' data created as nested programs within the EP.

jmohan05
Level 1

Re: API call to fetch Sub-programs in an Engagement program

Hi Darshil,

 

Two question in reference to this topic.

 

1. Is it also possible to create/update a Marketo Program with nested programs structure via API. 

2. GET call endpoint which you provided returns both the sub-program informations("id": 1380 and "id": 1382) , but there's no primary program information(1379). Is there a workaround to fetch the information of primary program as well (Default_Program_J)

 

{
"success": true,
"errors": [],
"requestId": "1553e#17fd49f6a5e",
"warnings": [],
"result": [
{
"id": 1380,
"name": "Program1_Email",
"description": "",
"createdAt": "2022-03-25T06:18:45Z+0000",
"updatedAt": "2022-03-25T08:42:09Z+0000",
"url": "https://XXX/#EBP1380A1",
"type": "Email",
"channel": "Email Send",
"folder": {
"type": "Program",
"value": 1379,
"folderName": "Default_Program_J"
},
"status": "unlocked",
"workspace": "Default",
"headStart": false
},
{
"id": 1382,
"name": "Program2_Event",
"description": "",
"createdAt": "2022-03-25T08:34:30Z+0000",
"updatedAt": "2022-03-25T08:42:48Z+0000",
"url": "https://XXX/#ME1382A1",
"type": "Event",
"channel": "Virtual Event",
"folder": {
"type": "Program",
"value": 1379,
"folderName": "Default_Program_J"
},
"status": "",
"workspace": "Default",
"headStart": false
}
]

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: API call to fetch Sub-programs in an Engagement program

1. You can create/update the sub-programs using the create/update programs endpoint - for creating the program as a nested sub-program you would wanna pass the {"id":<program id of the EP>,"type":"Program"} in the folder parameter of the application/x-www-form-urlencoded body.

2. You can fetch the program and the subprogram information in a single call using the browse folder endpoint - pass the following query parameters in the Get call: 

root = {"id":<EP program id>,"type":"Program"} 

maxDepth = 1

The endpoint with QPs (non-encoded) will look something like below:

 

https://ABC-123-abc.mktorest.com/rest/asset/v1/folders.json?access_token=<access-token>&root={"id":<EP-Program-id>,"type":"Program"}&maxDepth=1

 

Just a couple of caveats that this endpoint will return all the assets (programs and folders) created at the 1st level of the of the parent program - so if you have any marketing folders along with the subprograms created at level 1 in the engagement program, both marketing folders and subprograms at level 1 will be returned. However, if you do not have any marketing folders in the EP at level 1 then this endpoint will only return the parent engagement program and the nested subprograms within. And, of-course the program details will be not as comprehensive as you would get using the programs endpoint i.e., this endpoint will return program name and the id, but won't return other program data like program channel, etc.

With that being said, you can always use the get program by name endpoint to retrieve the parent EP program details separately and then use the endpoint I suggested in the comment yesterday to get the subprogram details.