API GET entries: Is it possible to pull some fields?

By: Luis De Pau | Asked: 06/18/2022
ForumsCategory: How-toAPI GET entries: Is it possible to pull some fields?
Luis De PauLuis De Pau asked 2 years ago
Hello!
I use the FF API to get the value of several forms of my site: https://domain.com/wp-json/frm/v2/forms/12/entries?page_size=15000  This gets all entries in form 12. My question: Is it possible to select de fields I want with the url? Something like fields=field1,field2  Thanks a lot!
1 Answers
Victor Font answered 2 years ago

This is a good question and the answer is to create your own REST endpoint.

According to this Formidable Knowledge Base article, there is a REST API route that can be used to retrieve a field value. The documentation implies one-field value at a time. There's no mention of multiple fields.

This has never been a requirement that I've looked into before, so I've never tried stacking multiple field requests in a single API call. Knowing a little about REST endpoints though, I doubt stacking will work. Don't let this discourage you from trying it. Great discoveries have been made through experimentation.

If this was a requirement in one of my paid projects, I would create a custom REST endpoint. Formidable uses the WordPress REST API to create its endpoints. Anyone can create REST endpoints and I've done it plenty of times on WordPress and WooCommerce projects, but never for Formidable.

If I were building the endpoint, I would use the same helper functions in Formidable's API add-on to create an endpoint that follows the plugin's route format. This is definitely a custom job, but it will give you exactly what you want to achieve.

If you want to see good examples of how to initialize a Formidable endpoint, look at the source code in /wp-content/plugins/formidable-api/controllers/FrmAPIFieldsController.php. Look at any code that uses the WordPress REST API function "register_rest_route()". Good luck with this.

Luis De PauLuis De Pau replied 2 years ago

Thanks a lot for your detailed response Victor! FF Support has already confirmed that this is not possible right now, so I guess doing it the way you propose is the right one. As I was in a hurry, I solved it with a google sheet addon https://logicsheet.co/ (as I'm pulling the data into a google sheet actually). You can use formulas to get the needed columns (fields).
Have a nice day!

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right