AnsweredAssumed Answered

Rest API, Lead Partitions, and Error on Update Lead

Question asked by 88dad46705157b6e715509ceb614fe0de109948e on Dec 12, 2014
Latest reply on Aug 24, 2015 by e848752bbf7cb055f938669514b1b2cead7c771b
Hi there,

We are using REST API to submit new leads from a particular area of our website; we are using lead partitions. We use this call to submit leads as follows:

We start by getting our auth token: 
            url = new URL(restEndPoint.concat("/identity/oauth/token")
                    .concat("?grant_type=client_credentials")
                    .concat("&client_id=").concat(clientId)
                    .concat("&client_secret=").concat(clientSecret)
 
Next we try and add our lead:
 
            url = new URL(restEndPoint.concat("/rest/v1/leads.json")
                    .concat("?access_token=").concat(authenticationJson.getAccess_token()));
 
Passing it our lead JSON.

If it’s a new lead, we get a success response.  If it’s an existing lead, we get a partition update error. 

{"requestId":"2fe6#14a0f34bc75","result":[{"status":"skipped","reasons":[{"code":"1010","message":"Partition update not allowed"}]}],"success":true}

I know for SOAP API, if you leave the header blank, leads get assigned upon creation to the default partition, and upon update are updated in their current partition. So why are we getting an error message here?

Also as a workaround, we tried the following:

At that point, I request the lead’s details from Marketo via: 
                        url = new URL(restEndPoint.concat("/rest/v1/leads.json")
                                .concat("?access_token=").concat(authenticationJson.getAccess_token())
                                .concat("&filterType=email")
                                .concat("&filterValues=").concat(request.getParameter("email"))
                                .concat("&fields=id,leadPartitionId")
 
Now I have a lead partition ID, but not it’s name.  I need the darn name to do the update.  So I do:
 
                        url = new URL(restEndPoint.concat("/rest/v1/leads/partitions.json")
                                .concat("?access_token=").concat(authenticationJson.getAccess_token())
 
To get a list of valid partitions.  This is when we get the 611 error.

However, this seems unnecessary -- any help out there?

Outcomes