Server side form post examples | Community
Skip to main content
November 19, 2015
Solved

Server side form post examples

  • November 19, 2015
  • 2 replies
  • 9226 views

Hi,

Im trying to do some server side form post like in this link http://developers.marketo.com/blog/server-side-form-post/  but im getting an error 400.

Does anyone have any examples of this procedure? Theres no dokumentation on what parameters that needs to be send in the POST

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by dadoly

Hi Rasmus,

Server side form posts are not something Marketo supports so you won't find a lot of examples around. Instead we recommend using a background Marketo form submission as described here:

http://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/

2 replies

dadolyAdobe EmployeeAccepted solution
Adobe Employee
November 19, 2015

Hi Rasmus,

Server side form posts are not something Marketo supports so you won't find a lot of examples around. Instead we recommend using a background Marketo form submission as described here:

http://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/

November 25, 2015

Hi Rasmus Bidstrup,

I know this is unsupported by Marketo, but I've been in a similar situation where I had to use an alternative method to submit a form via POST. You'll need the following info based on this article:

app-xx00.marketo.com/index.php/leadCapture/save?munchkinId=xxx-xxx-xxx&formid=0000&Email=example@domain.com&returnLPId=-1leadCapture/save?munchkinId=xxx-xxx-xxx&formid=0000&Email=example@domain.com&returnLPId=-1

The string app-xx00 corresponds to your specific Marketo app instance, xxx-xxx-xxx is your value for munchkinId (again unique for your instance), and formid value is the Marketo form you want to POST to. When correctly submitted this returns a 302 error, but you'll see a "filled out form" event in the lead record corresponding to the email address you submitted. Any additional fields you may need to send just need to use the SOAP API name of the field. Optionally, you can also pass Marketo's cookie using "_mkt_trk"

When I test this structure in hurl.it, I get a successful form fill event recorded in Marketo (the system will automatically create or update a lead record as necessary).

SanfordWhiteman
Level 10
November 25, 2015

app-xx00.marketo.com/index.php/leadCapture/save?munchkinId=xxx-xxx-xxx&formid=0000&Email=example@domain.com&returnLPId=-1leadCapture/save?munchkinId=xxx-xxx-xxx&formid=0000&Email=example@domain.com&returnLPId=-1

This URL implies a GET, not a POST. With some endpoints, either method can be used, but you may need to pass the canonical/default method as the _method param (_method=GET or _method=POST).

At the very least, even when not technically required, passing _method will show someone else looking at your code later that you're emulating another method due to technical restrictions (an example would be needing to pass a very large payload to a method that usually expects GET, so you POST the data but also include _method=GET to make the intent clear, as it is here).   More typically, this pattern is used to emulate truly unsupported methods like PUT.

Why are you GETting a forms endpoint, anyway?  It's rare that you would lack the control over the client needed to do a POST. Marketo webhooks support both, as of course do client-side form posts and XHRs.