Let’s say you have additional data about your leads that does not fit into the standard Marketo fields. For example, this custom field could be a third-party score. You can create a custom field in Marketo for your third-party score, and then update the value of this field via either the Marketo REST APIs or SOAP APIs.
We’ll show you first how to create a custom field in Marketo, and second how to update this field using the REST API.
How to Create a Custom Field in Marketo
1. Under Admin, click on Field Management.
2. Click the New Custom Field button.
3. Choose the field Type. This will change how it is rendered in Smart Lists and Forms in Marketo.
4. Enter the Name as you want it to appear in Marketo. Pick the Name and API Name carefully as renaming fields can be difficult and in some situations not possible.
5. The custom field you created is now accessible via the APIs.
How to Update Custom Field via REST API
In the previous section, we created a custom field called “myCustomField” with the data type string. To update the value of that field, we will use the REST API endpoint called Create / Update Leads.
Before you can make a request to the REST API, you will need to authenticate. This is outside of the scope of this article, but in-depth information is available on the Marketo developers site.
Below is a sample request body that could be used to update the value of “myCustomField” custom field using the Create / Update Leads endpoint.
Endpoint
1 |
/rest/v1/leads.json |
Request Body
1 2 3 4 5 6 7 8 9 |
{ "action":"createOrUpdate", "input":[ { "email":"example@example.com", "myCustomField":"examplestring" } ] } |
* This article contains code used to implement custom integrations. Due to its customized nature, The Marketo Technical Support team is unable to troubleshoot custom work. Please do not attempt to implement the following code sample without appropriate technical experience, or access to an experienced developer.