SOLVED

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

Go to solution
dvorontsov
Level 1

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

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...

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

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

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

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

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

dvorontsov
Level 1

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

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

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

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...

 

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

 

Thanks,
oz

dvorontsov
Level 1

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

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 - Community Moderator

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

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!