SOLVED

How can I tell if I can grab tokens from a folder?

Go to solution
Anonymous
Not applicable

How can I tell if I can grab tokens from a folder?

Hi there,

I'm digging into Marketo Asset database rest API. When I'm looking into Tokens endpoint, I noticed that the endpoint is in the format of:

GET /rest/asset/v1/folder/416/tokens.json?folderType=Folder or Program

So I first tried to retrieve all folders through:

GET /rest/asset/v1/folder/{id}.json?type=Folder

and grab some folder IDs there.

However, I see some of the responses shows an empty array of tokens for the specified folder, some return an error message like the following:

{

    "requestId": "15120#160fcb71012",

    "success": false,

    "errors": [

        {

            "code": "709",

            "message": "50 Folder not found"

        }

    ]

}

I'm pretty sure the folder id exists because I copied it from 'Folders'

So does anyone know why the folder was not found?

Thanks,

Jerry.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How can I tell if I can grab tokens from a folder?

I'm talking about Lead database (i.e. "People" in the UI after the recent naming changes) vs. Marketing Activities ("Marketing Activities" in the UI).

"Asset database" is too vague a term here.

To get folders from the Marketing Activities root, you want to set root=3.

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: How can I tell if I can grab tokens from a folder?

You're probably trying to read tokens from folders under Lead Database (as opposed to under Marketing Activities). The former can't have tokens, and even if the folder exists you'll see

     <id> Folder not found.

Anonymous
Not applicable

Re: How can I tell if I can grab tokens from a folder?

I see, thanks for the reply. So then how can I tell if the folder is from lead database or asset database? Is there a way to grab all folders from asset database only?

From what I know the folder endpoint is under asset database (at least in the api doc) : http://developers.marketo.com/rest-api/assets/

Thanks,

Jerry.

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I tell if I can grab tokens from a folder?

I'm talking about Lead database (i.e. "People" in the UI after the recent naming changes) vs. Marketing Activities ("Marketing Activities" in the UI).

"Asset database" is too vague a term here.

To get folders from the Marketing Activities root, you want to set root=3.

Anonymous
Not applicable

Re: How can I tell if I can grab tokens from a folder?

Hi Sanford,

Thanks a lot, I just confirmed, yes, all folders under Marketing Activities return expected response and folders under all other roots will return folder not found.

Btw, if I don't specify the folderType in query parameter(for example /folder/54/tokens.json without any parameters), will it return all tokens of both type Folder and type Program?

Also, how to create a token of type Program?

Thanks,

Jerry.

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I tell if I can grab tokens from a folder?

will it return all tokens of both type Folder and type Program?

I think it defaults to Folder (only) if folderType is omitted, rather than covering both folderType options. Might as well specify the type since you have to know it ahead of time.

Anonymous
Not applicable

Re: How can I tell if I can grab tokens from a folder?

I see, thanks. Do you know how to create a token of type Program? So that I can test them.

Thanks,

Jerry.

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I tell if I can grab tokens from a folder?

Using the UI, or using REST?  The token POST endpoint is in the docs...