Leads API - Lead id to email mapping in response (batch) | Community
Skip to main content
Level 2
May 7, 2021
Solved

Leads API - Lead id to email mapping in response (batch)

  • May 7, 2021
  • 2 replies
  • 3099 views

Hello, 

 

I am using rest/v1/leads.json POST endpoint to update and get lead ids by emails.  My input parameter is a list of emails.  In the response, I get a list of ids back, but I am unable to tell which id belong to which email.  Is there a way to get a response what maps emails to ids in a batch call?

 

Thank you,

Denys

 

API: https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads/syncLeadUsingPOST

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

? Each item in the results array corresponds directly to the item in the request array. Same order.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
May 7, 2021

? Each item in the results array corresponds directly to the item in the request array. Same order.

Level 2
May 7, 2021

Oh, I didn't realize the result was ordered the same as request.  Is the ordering always guaranteed?  I can't find anything about it on the API documentation, maybe I am missed it.  Is it documented anywhere?

 

Thank you!

Oz_Platero
Level 6
May 7, 2021

Hello @dvorontsov ,

 

In a separate call (since Sandy answered the mapping and order part);  for situations where you have ID's, but want to query other info you can use a GET call and pass the ID's to get those records back using Filter type and Filter values.

 

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads/getLeadsByFilterUsingGET

 

Be sure to include  fields you want such as email as fields to return.

 

Thanks,
oz

Level 2
May 7, 2021

Thank you, that is helpful to know!

 

My current problem is to get a mapping from list of email and list of ids.  I didn't know about the ordering part, and trying to verify if it's mentions in the documentation.

SanfordWhiteman
Level 10
May 7, 2021

Not sure why you'd expect it to be explicitly doc'd... the request array-response array paradigm is a universal thing. It would be shocking for the the order to be arbitrary!