SOLVED

Server Side Form Post Issues

Go to solution
Anonymous
Not applicable

Server Side Form Post Issues

I need to be able to submit a form from the server side; client side isn't an option, unfortunately. I tried following the directions here​, and am having some issues. The post goes through (returns 200), and new members are captured by the program to which the form belongs, but all of the associated post body information is stripped out. Additionally, when I look at the response content, it looks like the HTML for a marketo form. I'm hoping that it's just because I'm doing something dumb in my post formatting, so heres the python used to send the request.

body={

    "firstName": "Test",

    "lastName": "Person",

    "company": "TestCo",

    "email": "abc@fake.com",

    "munchkinId":"123-ABC-456",

    "formid":1165

  }

r = requests.post("https://app-mine.marketo.com/index.php/leadCapture/save", data = body)

The above returns a 200 status, with an html document as content. Program members are also created, with correct IP information and a 'filled out form' action, but nothing from the post body makes it in.

I've seen several other threads on here related to this topic, none of which have resolution yet. Has anyone successfully used this method?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Server Side Form Post Issues

The builtin fields are FirstName, LastName, etc. (note case).

View solution in original post

8 REPLIES 8
Roxann_McGlump1
Community Manager

Re: Server Side Form Post Issues

Hi Justin,

The document you linked carries this warning "Note: This is a non-public and unsupported API, it is not supported and its behavior may change at any time."  Given this, we recommend that you do not use it.  Instead, we recommend that you use the following:  http://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/

Anonymous
Not applicable

Re: Server Side Form Post Issues

Roxann,

Thanks for the quick reply! I was afraid you might say that. We're trying to avoid doing anything client side, as we have a centralized backend handler that deals with submissions from multiple sites as well as an iOS app, and don't want to have to copy code snippets between the various locations.

Is there a way to trigger a 'form filled' action via the marketo API?

Filling out forms is a very specific action that we need to record, but if it can be faked via the API that's just as good. I couldn't find this reading through the docs (Create/Update Leads » Marketo Developers ), but that doesn't mean it isn't there.

Roxann_McGlump1
Community Manager

Re: Server Side Form Post Issues

Hi Justin,

I don't have the coding chops to advise you of alternatives.  I'm not aware of any other options, but perhaps someone else has an idea.

Anonymous
Not applicable

Re: Server Side Form Post Issues

Hi Justin

Are your field names different than what Marketo form expects?

Rajesh

Justin_Cooperm2
Level 10

Re: Server Side Form Post Issues

Have you tried changing formid to be a string "1165"

SanfordWhiteman
Level 10 - Community Moderator

Re: Server Side Form Post Issues

The builtin fields are FirstName, LastName, etc. (note case).

Dan_Stevens_
Level 10 - Champion Alumni

Re: Server Side Form Post Issues

Good catch, Sanford.  Justin, if you're doing this for the first time, it might be helpful for you to create a test form/landing page that includes all of the forms fields you want to send over.  Once created, simply view the HTML of the landing page and you'll be able to grab the exact name/case of each field.  Looking at your fields above, every one is incorrect (from a case perspective) - except munchkinId.  And like Justin Cooperman​ stated, make sure the formid is of type string.

Here are the correct field names:

  • FirstName
  • LastName
  • Email
  • Company
  • formid
  • munchkinId
Anonymous
Not applicable

Re: Server Side Form Post Issues

This did it. I'd gone through several iterations of forms and cases, and had my keys set up lower camel cased, which was mismatching with the form. Thank you Sanford and everyone else who helped!