Retrieving a form via REST API and submitting via JavaScript SDK.

Graphic_Team
Level 1

Retrieving a form via REST API and submitting via JavaScript SDK.

Hi everyone,

I've tried to find an answer to this question here, on the forum or trying to understanding the Marketo's API; but I didn't find anything useful

I'm trying to combine REST API and JavaScript SDK to retrieving a form by the first and submitting with the second one, but I can't find a method to "associate" an already rendered form, with a custom HTML and custom rendering options, to a form object loaded by the loadForm function of MktoForms2.

Is there any way to do a job like this?

Thanks for all the support,

Gianluca

2 REPLIES 2
Jay_Jiang
Level 10

Re: Retrieving a form via REST API and submitting via JavaScript SDK.

Not very clear what your plan is or what you're trying to do with REST API. What do you mean "trying to retrieve a form via REST API"?

If you have your own HTML form, do you need to send the form data to a second endpoint?

If not, you can just have your own HTML form submit the form data to /index.php/leadCapture/save2 endpoint OR copy the input into a hidden Marketo form and submit the Marketo form

If yes, you can make an ajax call to your other endpoint after you've submitted the hidden Marketo form and using the MktoForms2 onsuccess callback

Graphic_Team
Level 1

Re: Retrieving a form via REST API and submitting via JavaScript SDK.

Hi Jay, thanks for the answer!

I think that submit directly the data to /index.php/leadCapture/save2 endpoint it's the best way to manage the form on my own.

Thank you.