Understanding How Folders Work With the Marketo API
One challenging concept when learning the Marketo API is understanding how folders function. While it may seem straightforward, there are a few nuances to keep in mind when using folders as parameters.
Folder ID
Finding the ID of an asset in Marketo is often easy by checking the URL. However, folder IDs for API purposes differ from those in the URL. To find the actual folder ID, use the GET Folder by Name
endpoint:
https://123-ABC-987.mktorest.com/rest/asset/v1/folder/byName.json?name=Your Folder Name&type=folder
In this example, the folder ID is 5181. This ID can now be used in other API calls as a filter value.
Two Different Types of Folders
In the Marketo API, both folders and programs can function as folders. It’s essential to specify whether you’re filtering by a folder or program. Here’s how filtering works in different scenarios.
Filter Type and Filter Values
When using endpoints like GET Programs, the parameter Filter Type
allows for multiple options, such as folderId
or programId
. In this case, set the filterValues
parameter to the folder ID, like 5181
from the example above.
JSON Key Value Pair
Some endpoints use JSON key-value pairs instead. For instance, with the GET Smart Campaigns endpoint, specify the folder as {‘type’: ‘folder’, ‘id’:1234}
or as {‘type’: ‘program’, ‘id’:1234}
for programs.