SOLVED

Re: Updating/Creating Leads with Partitions - 1005 Error

Go to solution
codyhenderson
Level 1

Updating/Creating Leads with Partitions - 1005 Error

My data engineers are running into an issue with the Marketo REST API. We are attempting to implement a process that creates leads in a specific partition, using email as a lookup. This works fine when a lead with a matching email does not exist in any partition. However, if a lead with the same email already exists in another partition, we are receiving an error:

 

{"code":"1005","message":"Lead already exists"}

 

It appears that in this case the API is ignoring the partitionName that we are providing in the POST request body.

 

For reference, here is the URL endpoint we are hitting, an example request body, and example request headers.

 

Endpoint:

https://xxx.mktorest.com/rest/v1/leads.json?access_token=XXX

 

Body:

{"action": "createOnly", "lookupField": "email", "partitionName": "XXX", "input": [{"firstName": "TestName1", "lastName": "TestName2", "email": "testemail@gmail.com"}]}

 

Headers:

{'User-Agent': 'python-requests/2.25.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '179', 'Content-Type': 'application/json'}

 

Response:

{"requestId":"1e03#17a83020200","result":[{"status":"skipped","reasons":[{"code":"1005","message":"Lead already exists"}]}],"success":true}

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Updating/Creating Leads with Partitions - 1005 Error

This is expected behavior. If you want something different, pre-query for the existence of the lead.

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Updating/Creating Leads with Partitions - 1005 Error

This is expected behavior. If you want something different, pre-query for the existence of the lead.
codyhenderson
Level 1

Re: Updating/Creating Leads with Partitions - 1005 Error

Are you saying that it's expected for a createOnly action to ignore the partitionName specified? So there is no way to create a lead in a specific partition if another lead already exists with the given lookupField value (email in this case) in another partition? We can work around this, but it feels limiting from the perspective of treating each partition as a separate entity/client that may share the same leads. 

SanfordWhiteman
Level 10 - Community Moderator

Re: Updating/Creating Leads with Partitions - 1005 Error

Yes, the way you imagined partitions to work by default... isn't the way they work. 🙂

You can read more in this very recent thread, the identical question really: https://nation.marketo.com/t5/product-discussions/unable-to-create-new-lead-profile-in-a-different-p...
codyhenderson
Level 1

Re: Updating/Creating Leads with Partitions - 1005 Error

Great! Our setup is definitely unique. 🙂

 

Thanks for the info and the link.