create/update different leads using rest api lookupField, returns a list of same one lead id

Anonymous
Not applicable

create/update different leads using rest api lookupField, returns a list of same one lead id


When I try to use Create/Update Leads REST API, http://developers.marketo.com/documentation/rest/createupdate-leads/
 I got wrong api call results as described below:

NOTE: before the api call:
On Marketo, I already have leads with id=14 and id=15.

Request url:
https://541-KMH-410.mktorest.com/rest/v1/leads.json?access_token=86160629-baff-41c7-ad3b-d7c6adbaa739:sj

Post Request body:
{"input":[{"id":15,"lastName":"las15UNKNOWN","email":"em15ttt@np.com","firstName":"fis15Unknown"},{"id":14,"lastName":"las14UNKNOWN","email":"em14ttt@np.com","firstName":"fir14Unknown"}],"action":"createOrUpdate", "lookupField":"id”}


Response body:
{"requestId":"10a78#14736a883ab","result":[{"id":14,"status":"updated"},{"id":14,"status":"updated"}],"success":true}

NOTE: after the api call:
On Marketo, the lead with id=14 is wrongly updated by the request contents for id=15, also the lead with id=15 is not updated at all.


Expected Results:
The Response body should have both “id”:14 and “id”:15 and their status correspondingly, not two “id”:14 and “id”:14.
On Marketo, lead with id=14 and id=15 should updated with its request contents correspondingly.


Although the errors above, I tried further and I have a few more questions below:
  • If I don’t include “lookupField” in the post request body, it will create two more Leads although id=14 and id=15 already exist on Marketo. Do I have to include  "lookupField":”id” to match existing lead on Marketo for createOrUpdate?
  • If I have “lookupField”:”email” in the request body but for one of the leads it doesn’t  have email in the request body input, I got error response: "status":"skipped","reasons":[{"code":"611","message":"System Error”}] Do I always need to have email in request content for the lead update if I have email as lookupField?
  • Is there a limit for the number of leads I can createOrUpdate in one request above? For example, in request body, can I have 100,000 leads in one request?
Tags (1)
6 REPLIES 6
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

Hey Larry, we're having the same issue.

I can answer one of your questions though. You can only createorupdate 300 leads per request.

Also, keep in mind that you can only add 100 leads to a list per request.

None if this seems to be documented anywhere.
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

Michiel,
I apprecaited your answers. The call limit info you provided are important for us.

Regarding the issue on lookupField id doesn't update all records:
We submitted a Marketo Customer Support case #00310342 and got an answer from James Zeigler, we took a work-around to use a cusom field and the value populated via a flow step of Change Data Value to {{lead.ID}} token.

Cheers.
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

Hey Larry,
I'm not fully understanding your resolution.

Are you using the custom field rather than Id and still using the lookup parameter?

Could you maybe give me an example and/or a small code snippet?
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

Michiel,
Here's my work-around:
On my marketo instance,
1. Create a custom field called 'npMarketoLeadId'. Admin -> Field Management -> New Custom Field,
2. Create a trigger to copy lead.ID to custom field. Marketing Activities -> Lead Lifecycle -> "Lead Created" -> Flow -> Change Data Value: Attribute: npMarketoLeadId. View Value: {{lead.ID}}

On my rest API create/update leads calls, If I have a marketo lead id's, when send to marketo, I use {"action":"updateOnly"} with {"lookupField" : "npMarketoLeadId"}; If I don't have markeot lead id's, then cretae leads on marketo and don't have lookupField in my request.

With this work-around, it works ok.
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

That for your response Larry.

I tried to implement what you said, but I just get "code":"1004","message":"Lead not found" when trying to update my leads.

My json request looks like this:

{
    "lookupField":"TestMarketoLeadId",
    "action":"updateOnly",
    "input":
    [
        {
        "TestMarketoLeadId":826670,
        "accountID":1234,
        "TitleID":2},
        {
        "TestMarketoLeadId":826669,
        "accountID":6789,
        "TitleID":2
        }
    ]
}

I did not include a lookup field on initial import.
I also verified my custom field "TestMarketoLeadId" is populated with the LeadId value.
Anonymous
Not applicable

Re: create/update different leads using rest api lookupField, returns a list of same one lead id

Michiel,
I am crunched on time, just got to did following to see that it works:


1)POST
https://541-kmh-410.mktorest.com/rest/v1/leads.json?access_token=...
Content-type: application/json;

{"input":[{"firstName":"Larry1"},{"firstName":"Larry2"}]}

2) Got response:
{"requestId":"22fa#14775ff8d5b","result":[{"id":106,"status":"created"},{"id":105,"status":"created"}],"success":true}


3) POST
https://541-kmh-410.mktorest.com/rest/v1/leads.json?access_token=...
Content-type: application/json;

{"input":[{"firstName":"LarryOne", "npMarketoLeadId":106},{"firstName":"LarryTwo", "npMarketoLeadId":105}], "lookupField":"npMarketoLeadId", "action":"updateOnly"}

4)Got response
{"requestId":"159a5#14776067f11","result":[{"id":106,"status":"updated"},{"id":105,"status":"updated"}],"success":true}


Michiel, about your post above, you might check lookupField":"TestMarketoLeadId", also I am not sure about "accountID" and "TitleID" fields.  If it is still not work and you want go through it quickly, you might email me larry@nextprinciples.com directly.