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?
Solved! Go to Solution.
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.
Great! Our setup is definitely unique. 🙂
Thanks for the info and the link.