SOLVED

Re: Updating leads using lead.id via api

Go to solution
raiashutosh
Level 2

Updating leads using lead.id via api

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

1 ACCEPTED SOLUTION

Accepted Solutions
LucasMachado
Level 2

Re: Updating leads using lead.id via api

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.

View solution in original post

Tags (2)
2 REPLIES 2
LucasMachado
Level 2

Re: Updating leads using lead.id via api

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.

Tags (2)
raiashutosh
Level 2

Re: Updating leads using lead.id via api

Thanks @LucasMachado !!