SOLVED

How to get default value of a form field through the REST API

Go to solution
Highlighted

How to get default value of a form field through the REST API

Hello!

I'm using the Marketo Rest API to get individual fields for each form for an application I'm working on.  I'm able to get the metadata for each field by form ID but the results don't include default values.  Any idea how to get this information through the API?

Right now I'm querying the form using "/rest/asset/v1/form/{formId}.json" and querying the fields using "/rest/asset/v1/form/{formId}/fields.json".

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: How to get default value of a form field through the REST API

I agree with you, Dennis. This is a bug of omission and I can't find query/cookie source metadata, either.  I opened an Idea for it.

In the meantime you might want to try using the Forms API /getForm endpoint instead, which (by necessity) has everything:

     https://:MarketoPodHostname.marketo.com/index.php/form/getForm?munchkinId=:MarketoMunchkinID&form=:F...

View solution in original post

5 REPLIES 5
Highlighted
Level 10 - Community Moderator

Re: How to get default value of a form field through the REST API

...but the results don't include default values.

Sure they do.

The defaultValue property of each field object.

Highlighted

Re: How to get default value of a form field through the REST API

defaultValue property shows on selects but not hidden elements.  Is this a bug in the Marketo Rest API?

Highlighted

Re: How to get default value of a form field through the REST API

marketo.jpg

Highlighted
Level 10 - Community Moderator

Re: How to get default value of a form field through the REST API

I agree with you, Dennis. This is a bug of omission and I can't find query/cookie source metadata, either.  I opened an Idea for it.

In the meantime you might want to try using the Forms API /getForm endpoint instead, which (by necessity) has everything:

     https://:MarketoPodHostname.marketo.com/index.php/form/getForm?munchkinId=:MarketoMunchkinID&form=:F...

View solution in original post

Highlighted

Re: How to get default value of a form field through the REST API

Thanks Sanford! I'll give your suggestion a try in the meantime.