Using the REST API to update leads, got "field not found" error

Anonymous
Not applicable

Using the REST API to update leads, got "field not found" error

We have custom fields for leads like UTM Source and UTM Medium.

I want to use the REST API to update these fields for leads.

I tried using the /rest/v1/leads.json endpoint with this request:

POST /rest/v1/leads.json HTTP/1.1
Content-Type: application/json
Authorization: Bearer TOKEN
{"action":"updateOnly","lookupField":"id","input":[{"id":LEAD_ID,"UTM Medium":"MEDIUM","UTM Source":"SOURCE"}]}

But I got this response saying the fields were not found:

{"requestId"=>"143e9#1497880b900",
 "result"=>
  [{"status"=>"skipped",
    "reasons"=>
     [{"code"=>"1006", "message"=>"Field 'UTM Medium' not found"},
      {"code"=>"1006", "message"=>"Field 'UTM Source' not found"}]}],
 "success"=>true}
Tags (1)
2 REPLIES 2
Anonymous
Not applicable

Re: Using the REST API to update leads, got "field not found" error

Solved: I had to find the actual field name by going to Admin > Field Management.

See https://community.marketo.com/MarketoArticle?id=kA050000000LNKJCA4
Anonymous
Not applicable

Re: Using the REST API to update leads, got "field not found" error

You can also use the Describe REST API to get a list of field names.