API call to fetch Sub-programs in an Engagement program | Adobe Higher Education
Skip to main content
Level 1
March 28, 2022
Respondido

API call to fetch Sub-programs in an Engagement program

  • March 28, 2022
  • 1 resposta
  • 2249 Visualizações

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.

 

 

{{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

 

Melhor resposta por Darshil_Shah1

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.

1 Resposta

Darshil_Shah1
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 28, 2022

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.

Level 1
March 29, 2022

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
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 29, 2022

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.