HTTPS Form Data Re-Post | Community
Skip to main content
New Participant
May 18, 2021
Solved

HTTPS Form Data Re-Post

  • May 18, 2021
  • 1 reply
  • 3896 views

Hi all,

I'm wondering if someone knows if it is possible to post data to a Marketo form via https data re-post for example just using the link like this one directly in the browser: app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=test@test.com&FirstName=Test&LastName=TestSurname

When testing the link (of course using proper Marketo instance, munchkin & form IDs for our instance) I get the following error: {"error":true,"errorCode":500,"errorType":"serverError","message":"Parsing a Body as FormData requires a Content-Type header."}

Do you know what is this error and how can it be solved? I can't find it in the Marketo error codes documentation... (https://developers.marketo.com/rest-api/error-codes/).

Is the approach I'm describing possible at all?

Thanks in advance for your help!

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 SanfordWhiteman

...just using the link like this one directly in the browser: app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=test@test.com&FirstName=Test&LastName=TestSurname

It's not possible to hit the /save or /save2 endpoints with your own crafted payload, no.

 

You need to use the Marketo Forms JS API to post the data. It's very simple. Use the embed code, but set the form to hidden:

<form hidden id="mktoForm_1234"></form>

 

Then add your data to the hidden form and call submit().

// run this only when your visible form is ready to post
if( yourFormIsPostable) {
  MktoForms.whenReady(function(mktoForm){
    mktoForm.addHiddenFields({
      whatever : "fields",
      you : "want",
      using : "SOAP field names, not REST"
    });
  });
  mktoForm.submit();
}

 

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 18, 2021

...just using the link like this one directly in the browser: app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=test@test.com&FirstName=Test&LastName=TestSurname

It's not possible to hit the /save or /save2 endpoints with your own crafted payload, no.

 

You need to use the Marketo Forms JS API to post the data. It's very simple. Use the embed code, but set the form to hidden:

<form hidden id="mktoForm_1234"></form>

 

Then add your data to the hidden form and call submit().

// run this only when your visible form is ready to post
if( yourFormIsPostable) {
  MktoForms.whenReady(function(mktoForm){
    mktoForm.addHiddenFields({
      whatever : "fields",
      you : "want",
      using : "SOAP field names, not REST"
    });
  });
  mktoForm.submit();
}