SOLVED

HTTPS Form Data Re-Post

Go to solution
Simone
Level 1

HTTPS Form Data Re-Post

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: https://app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=t...

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!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: HTTPS Form Data Re-Post


...just using the link like this one directly in the browser: https://app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=t...

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();
}

 

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: HTTPS Form Data Re-Post


...just using the link like this one directly in the browser: https://app-xxx000.marketo.com/index.php/leadCapture/save?formid=1000&munchkinId=000-XXX-000&Email=t...

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();
}

 

View solution in original post