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:
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?