8 Replies Latest reply on Apr 6, 2017 12:25 PM by Alex Bridges

    Push leads to Marketo via REST API - help with structuring the URL?

    Alex Bridges

      Hello fine members of Marketo Nation!

       

      I am once again in need of your help. I'm trying to help a 3rd party push leads to our Marketo instance via the REST API, and I'm struggling to get it to work. Thing is, in the past, we got it to work with another company, and they provided a clip of the string they used, so I thought "hey we can totally use that in this instance too" since this client is trying to do the same thing. Ha! If only it were so easy!

       

      Anyway, here's what they're sending to us:

       

      https://[exampleEndpoint].mktorest.com/rest/v1/leads/push.json?access_token=[ourToken]&[customField]=value&firstName=John&lastName=Smith&postUrl=https://350-yae-212.mktorest.com/rest/v1/leads.json&emailAddress=test@test.com&clientId=[clientId]&tokenUrl=https://[exampleEndpoint].mktorest.com/identity/oauth/token&secretKey=[secretKey]&grant_type=client_credentials&action=createOnly

      And here is the error that's returned:

      {"requestId":"[insert numbers here]","success":false,"errors":[{"code":"1001","message":"For input string: \"push\" failed to convert to a number"}]}

       

      Okay, so, I looked that error code up, and my impression is that it's assigning a bad field type somehow. (trying to convert a string to an integer? or am I totally off base here?) I've got no idea where to even start here, though, since I'm not sure what it looks like on their side to push the lead to us to begin with. Am I forming the URL incorrectly? If there's no way for me to test it in my side (though I can return the same error if I just click on the link in my browser), is there a direction I can point them in for doing it correctly?

       

      Uggh databases, amirite?

      Til next time,

      -Alex

        • Re: Push leads to Marketo via REST API - help with structuring the URL?
          Sanford Whiteman

          That's... a lot of things jumbled together.

           

          A Push Leads endpoint looks like this:

           

          https://123-abc-456.mktorest.com.rest/v1/leads/push.json

           

          It accepts

           

               Content-Type: application/json

           

          This is all in the docs. I hope the 3rd party is looking at the developer docs: as sparse as they can be, it's a lot worse without them.

           

          Note you shouldn't use Push Leads if it can be at all avoided. For example a 3rd party form should use the Forms API. 

          1 of 1 people found this helpful
            • Re: Push leads to Marketo via REST API - help with structuring the URL?
              Alex Bridges

              I've sent them the product docs, and this is what they came up with after reading it. Hearing that it is nonsensical does help put us in the right direction. I often feel like I'm taking random stabs in the dark with this particular subject...

               

              I agree that the Forms API makes a lot more sense, and this is usually the first solution I put forward in this situation. However, what's happening here is that the 3rd party is an affiliate site, and they send us the leads, which we're paying for. So they want to be able to track the leads. Would it make sense then for me to create a webhook to push leads to them instead?

                • Re: Push leads to Marketo via REST API - help with structuring the URL?
                  Sanford Whiteman

                  If they only have access to the final lead info on their back end (i.e. they must do post-processing before sending them to you), then sadly the Push Leads endpoint is as good as you're going to get.

                   

                  But if they looked at the docs and that's what they came up with, they don't seem like they have the skills for this.

                   

                  If you could reverse it so you get the leads first, you could certainly use a webhook to push lead info to them (for example, posting to their forms endpont).

                   

                  Or a single form could even be used to push leads to their side (using whatever) and to your side (using the Forms API), a form of 2-phase commit.

                  1 of 1 people found this helpful