Re: How do I check what munchkins are associated with a lead?

Dev_Team
Level 2

I'm happy to provide more specific information if needed but basically:

 

1) User submits form

2) We push lead to Marketo using REST API (/rest/v1/leads/push.json)
3) We associate munchkin with the lead with REST API (/rest/v1/leads/{leadId}/associate.json)

How do I check if this munchkin has been successfully associated?

 

12 REPLIES 12
SanfordWhiteman
Level 10 - Community Moderator

Also, you're already using 2 REST API calls for something the Forms 2.0 JS API can do with zero API calls.

 

Have you been thinking about the DoS vulnerability here?

Dev_Team
Level 2

Yes, I have seen you bring this up in other forum posts.

I will bring this up and discuss it further with some of my more experienced colleagues. I think the reason we are trying to use the REST API is so we can move the Marketo interactions to our backend. This way we don't have to worry so much about ad-blockers preventing us from interesting with Marketo. 

SanfordWhiteman
Level 10 - Community Moderator
This way we don't have to worry so much about ad-blockers preventing us from interesting with Marketo. 

Doesn't make sense. You're not going to have a Munchkin cookie if an ad blocker blocks marketo.com and mktoresp.com.

 

A Marketo form can work with an ad blocker running b/c it's not necessary for it to have any reference to Marketo-operated domains.

SanfordWhiteman
Level 10 - Community Moderator

If the cookie exists at all, then a successful call to the Associate Lead endpoint means it was associated.

 

You do not want to be checking the cookies field after every association, that would be a worst practice.

Dev_Team
Level 2

Thanks so much for the quick response Sandford.

Yes, I will not be deploying a check of the cookies field into prod however, when I tried to check it to see if it was working correctly it's value was null. Does that mean it hasn't been associated?

The way I tried to check was again with the REST API (/rest/v1/lead/{leadId}.json?fields=cookies`).

SanfordWhiteman
Level 10 - Community Moderator

That is indeed the way to spot-check. Are you sure you URL-encoded the cookie value correctly?

Dev_Team
Level 2

I am not sure TBH. I am currently grabbing the _mkto_trk cookie value and passing that through so is request looks something like:

https://000-aaa-777.mktorest.com/rest/v1/leads/1234567/associate.json?cookie=id:000-AAA-777&token:_m...

SanfordWhiteman
Level 10 - Community Moderator
 I am currently grabbing the _mkto_trk cookie value and passing that through so is request looks something like:

https://000-aaa-777.mktorest.com/rest/v1/leads/1234567/associate.json?cookie=id:000-AAA-777&token:_m...

You can't send the token unencoded like that, the "&" is going to break the query string into two parts, by definition.

 

You must always, always URI encode any query param name or param value. 

Dev_Team
Level 2

Ahhh, thank you so much! That was the issue. You have helped me a lot.

SanfordWhiteman
Level 10 - Community Moderator

@Dev_Team pls return to the thread and mark one of my answers as the Solution, thanks.

Dev_Team
Level 2

Ahhh, thank you so much! That was the issue. You have helped me a lot. 

SanfordWhiteman
Level 10 - Community Moderator

OK, pls mark one of my answers as the Solution, thx.