Basic rundown of the process for creating a custom form and passing the data to an endpoint for Marketo.
I am currently using Netlify and need a way to either, send form data to an existing Marketo form, which I read about in the forums (seems a little cumbersome), or use our custom forms and pass that data over an API into Marketo.
This is not a lazy request or a "do it for me" question. I have genuinely spent hours looking at the forums and documentation and get conflicting ideas. I see posts about people using an API one way, but told they should just use Forms 2.0. I can't find a legitimate source for how to set up my own custom form and pass that data to Marketo via API.
I'm hoping someone can point me in the right direction. I think I might not be looking at the correct stuff, otherwise, I think I would have found a palatable answer by now. I can't use any Marketo Forms, they have to be completely custom HTML and CSS.
Unfortunately, your title is adding to/indicative of your confusion, I'm afraid. You don't want to "make a form" (i.e. create a form asset) via an API -- that is a completely different topic. You want to post the data from a custom HTML form via an API.
Second, there are 2 very distinct APIs in question: (1) the Forms 2.0 JS API, which runs in the browser, and which you should use; (2) the REST API, which you should not use. So sometimes people say "just use 'the' API" and that doesn't make it easier to understand!
I am currently using Netlify and need a way to either, send form data to an existing Marketo form, which I read about in the forums (seems a little cumbersome),
This is the only scalable and reliable option. For most custom forms, it takes only a handful of lines of code to bridge from your form fields to a hidden Marketo form. That hidden form is submitted in the background, while the visible form is filled out by end users (and not itself submitted, though this fact is transparent to the end user).
I see posts about people using an API one way, but told they should just use Forms 2.0. I can't find a legitimate source for how to set up my own custom form and pass that data to Marketo via API.
Because there in fact is no single "post to (REST) API" method. You would need 2 REST API calls, 3 when you include the access token endpoint, and your own server/service, to even approach the functionality of a hidden Marketo form. So let's not even consider that option.
The Forms 2.0 JS API has methods /blogs/marketowhisperer/2015/09/30/make-a-marketo-form-submission-in-the-background . A much more robust example is here: MktoForms2 :: Basic HTML form to Mkto form. This second example uses more scalable logic that I built a couple of years ago, overkill for a one-off effort but I have to do this constantly for clients so wanted something reusable. In the second example you can also see the Marketo form (it's faded out, instead of completely hidden) which is important for debugging. (You should only hide the form using when you're ready to publish the page.)and , which allow you to use all the Marketo form functionality (hidden UTM fields, session association, etc.) without showing the form. A dirt-simple example is illustrated here: