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?
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.
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`).
That is indeed the way to spot-check. Are you sure you URL-encoded the cookie value correctly?
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...
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.
Ahhh, thank you so much! That was the issue. You have helped me a lot.
OK, pls mark one of my answers as the Solution, thx.
Ahhh, thank you so much! That was the issue. You have helped me a lot.
@Dev_Team pls return to the thread and mark one of my answers as the Solution, thanks.