Updating leads using lead.id via api | Community
Skip to main content
Level 2
September 21, 2021
Solved

Updating leads using lead.id via api

  • September 21, 2021
  • 1 reply
  • 5373 views

Hi Guys,


We have a list of client data (list with their lead.id) and want to update a custom field of these clients. I learned that we cannot import a file with just lead.id to update the data fields.
However, we can create an API call to update the existing record with lead.id. can some please share a sample API call for this?

Thanks!
Ashutosh Rai

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 LucasMachado

Hello,

 

I think you should use the endpoint /rest/v1/leads.json and build the body of the message to update the fields you want. In this link there is an example:

https://developers.marketo.com/rest-api/lead-database/leads/

It is important to correctly define the action ("createOrUpdate", "createOnly" or "updateOnly). In this case I'd recommend you to use the "updateOnly", otherwise marketo will create a new lead if it doesn't find the lead you want to update. Also choose "id" as your "lookupField" so it will query the lead with same lead id.

When I first used this API I was working with a instance that had many partitions and I wasn't being able to find the right lead to update. If this is your case use the "partitionName" attribute to choose the right partition your leads are in.

1 reply

LucasMachado
Adobe Champion
LucasMachadoAdobe ChampionAccepted solution
Adobe Champion
September 21, 2021

Hello,

 

I think you should use the endpoint /rest/v1/leads.json and build the body of the message to update the fields you want. In this link there is an example:

https://developers.marketo.com/rest-api/lead-database/leads/

It is important to correctly define the action ("createOrUpdate", "createOnly" or "updateOnly). In this case I'd recommend you to use the "updateOnly", otherwise marketo will create a new lead if it doesn't find the lead you want to update. Also choose "id" as your "lookupField" so it will query the lead with same lead id.

When I first used this API I was working with a instance that had many partitions and I wasn't being able to find the right lead to update. If this is your case use the "partitionName" attribute to choose the right partition your leads are in.

Level 2
September 22, 2021

Thanks @lucasmachado !!