Let’s say you want to change a lead’s score in Marketo using the APIs. This is possible to do with the REST API using the Create/Update Lead endpoint. Below is a code sample in Ruby that shows how to make this call.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
require 'rest_client' require 'json' #Build request URL #Replace AAA-BBB-CCC with your Marketo instance marketo_instance = "https://AAA-BBB-CCC.mktorest.com" endpoint = "/rest/v1/leads.json" #Replace with your access token auth_token = "?access_token=" + "ac756f7a-d54d-41ac-8c3c-f2d2a39ee325:ab" request_url = marketo_instance + endpoint + auth_token #Build request body data = { "action" => "updateOnly", "input" => [ { "email" => "example@email.com", "leadScore" => "30" } ] } #Make request response = RestClient.post request_url, data.to_json, :content_type => :json, :accept => :json #Returns Marketo API response puts response |
In the JSON body of the request, we specify updateOnly as the … Continue reading “Change a Lead’s Score via the REST API”