Form submission using POST menthod

Amit_Jain
Level 8 - Community Advisor

Re: Form submission using POST menthod

Sorry for delayed response Sanford Whiteman‌.

Please see below screenshot from ManyChat. If you can turn on the server again, that would be really helpful.

pastedImage_1.png

Amit_Jain
Level 8 - Community Advisor

Re: Form submission using POST menthod

Hi Sanford Whiteman‌, please let me know when you will be available to take a look on this? I'll be online the same time.

Regards,

Amit

Amit_Jain
Level 8 - Community Advisor

Re: Form submission using POST menthod

I got it now. Sorry I just started learning the API stuff. So I'm using this now:

Endpoint URL with POST method:

https://app-sxxx.marketo.com/index.php/leadCapture/save2?formVid=36496&munchkinId=xxx-xxx-xxx

Body:

{
   "FirstName ":"First Name",
   "LastName ":"Last Name",
   "Email ":"Email Address",
   "Dummy_Text_Area_1 ":"Preferred Meeting time",
   "cellPhoneNumber ":"Phone"
}

Is this looks OK now? Please let me know. Sanford WhitemanJay Jiang

Edited: When I'm trying this, its making the call in Marketo but it's creating a lead record without any data in it.

pastedImage_1.png

But if I pass these in URL parameter instead of Body, it creates lead record with all the details.

Jay_Jiang
Level 10

Re: Form submission using POST menthod

a serialized POST payload is formatted exactly the same as a query string:

param1=value1&param2=value2&paramN=valueN

You're trying to send an object and marketo doesn't recognize it.

I'm actually confused what you're trying to do/achieve.

SanfordWhiteman
Level 10 - Community Moderator

Re: Form submission using POST menthod

And in addition, I can see that it isn't URL-encoding, which is bad.

Amit_Jain
Level 8 - Community Advisor

Re: Form submission using POST menthod

I'm not sure how can I encode the URL here from the UI (see above screenshot). If you have any thoughts on that, please let me know. I'm just trying to see if it's possible to integrate ManyChat with marketo directly but if you think this is not going to work like this, I have Zapier subscription and can use that to pass the data from ManyChat to Marketo.

Thanks again for your help on this.

Best,

Amit

Jep_Castelein2
Level 10

Re: Form submission using POST menthod

Small correction: "30 form posts per minute per IP", not per second

SanfordWhiteman
Level 10 - Community Moderator

Re: Form submission using POST menthod

Sorry, yeah, meant that. Fixed.

Jay_Jiang
Level 10

Re: Form submission using POST menthod

https://xxxx.marketo.com/index.php/leadCapture/save2?formid=1234&munchkinId=xxx-xxx-xxx

You should be including the parameters in the body of the POST. Adding it to the URL is GET.

You can post to save2 server side (apparently you just need to add "formVid"). But warning that the anonymous IP address will be that of the server's and any inferred data will be incorrect.

CURL example in php

<?php
$fields = [
'formid'=>1234,
'formVid'=>1234,
'munchkinId'=>'xxx-xxx-xxx',
'Email'=>'abc@cba.com' // Email not email
];
$payload = '';
foreach($fields as $k=>$v) { $payload .= $k.'='.$v.'&';}
$payload = rtrim($payload , '&');
$ch = curl_init('https://xxxx.marketo.com/index.php/leadCapture/save2');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
?>
Amit_Jain
Level 8 - Community Advisor

Re: Form submission using POST menthod

Hi Jay,

What is the purpose of formVid here? When I added this in the request, Marketo accepted it and before I was getting 404?

Regards,

Amit