Does Marketo's API decode encoded URLs?

Highlighted
Anonymous
Not applicable

Does Marketo's API decode encoded URLs?

Hello,

I'm testing the Get Multiple Campaigns API (which we use with the optional programName parameter) with a program name that has special characters in it (like an ampersand or a comma). These characters are preventing campaigns from being returned. I attempted to encode the URL, but it looks like Marketo doesn't decode the URL on their end, because I'm still unable to retrieve campaigns.

Does anyone know a way around this? Is there something I'm missing here? Is the only solution simply that users of our integration should just not include special characters in their program names?

Thanks!

3 REPLIES 3
Highlighted
Level 10 - Community Moderator

Re: Does Marketo's API decode encoded URLs?

A comma doesn't to be encoded in a query string (or query string-like form payload).  An ampersand, yes.

Can you provide the code you're using and the (plaintext) program name you're trying to access?

Highlighted
Anonymous
Not applicable

Re: Does Marketo's API decode encoded URLs?

I'm pretty much following the example Ruby code here:

http://developers.marketo.com/documentation/rest/get-multiple-campaigns/

A sample URL I'm using, which returns campaigns accurately in all other cases, looks like this: /rest/v1/campaigns.json?programName=My Program Name

Let's say I'm trying to access the campaigns under a program named "ABC_12-34-56-Abc & Abc, Abc123." This is what's happening:

  • When I don't encode the URL at all, this is how the URL is actually being sent to Marketo. The ampersand is basically breaking up the URL.
    • rest/v1/campaigns.json?+Abc%2C+Abc123&programName=ABC_12-34-56-Abc+
  • When I encode the URL, this is how the URL is being sent to Marketo. It looks like Marketo doesn't know what to do with this URL, and I still get zero campaigns under the program.
    • rest/v1/campaigns.json?programName=ABC_12-34-56-Abc+%26+Abc%2C+Abc123
  • Let's say I get rid of the ampersand entirely, and only focus on the comma - if I send over the program name "ABC_12-34-56-Abc and Abc, Abc123" without any encoding done on my end, the comma in the URL is getting sent over encoded by default, and Marketo still isn't returning any campaigns.
    • /rest/v1/campaigns.json?programName=ABC_12-34-56-Abc+and+Abc%2C+Abc123

Any ideas?

Thanks!

Highlighted
Level 10 - Community Moderator

Re: Does Marketo's API decode encoded URLs?

What's happening is the comma is used as in internal (non-HTTP) delimiter by Marketo, so it has a reserved internal use.

programName=me,mine,moo is searching for 3 program names.

While there should be a way of quoting the entire name "me,mine,moo" I don't know what syntax the API supports for that. URL-encoding the comma won't suffice because that just keeps the whole param on the wire to Marketo, it doesn't change the internal meaning within Marketo.

Kenny Elkington