Is there a way in Marketo to create some type of custom API endpoint that will allow me to return a list of fields for a given country name?
This is my use case:
I want my marketing team to be able to manage a list of questions in Marketo. These questions will be conditionally shown to a user depending on the country they are from. I will then have a custom form on a proprietary website that will fetch these questions from this Marketo API based on their country.
Is this possible?
Have you looked into visibility rules? These may be able to do what you're describing without custom coding: Dynamically Toggle Visibility of a Form Field - Marketo Docs - Product Documentation .
The answer hinges on whether you're
If you don't care that someone could inspect the form source and see all the other countries' questions, then you could do exactly as Mariah describes. Use Visibility Rules and have all the rules in the Form Editor UI. Easy-peasy.
If you want to conceal the other countries' possible questions from an (extremely) casual snooper, then you can't use VRs, because a curious person can see all the possible qs if they look at the JSON for the form. If you have a truly massive amount of data (like 50K+ possibilities) you'd also not want this in the form descriptor as it would slow loading. In either of these cases, you'd be out of luck because you're using a non-Marketo LP. Conversely, if you were on a Marketo LP, you could upload a different file for each country in Design Studio and load only one of them, selectively.