How to display Toolset custom fields with Rest Routes

In this post we will learn a bit about the compatibility work that we’ve done recently with Toolset Types (single and repeating fields)

By Adriano Ferreira

Rest Routes and Toolset Types custom fields

 

We’ve been busy these weeks working in a major feature for Rest Routes. After noticing that many of our clients are actively using Toolset Types for building custom fields, we’ve decided to integrate it with our Pro plugin. Now, you can easily expose Toolset Types custom fields through your custom endpoints built with Rest Routes Pro.

You will be able to display any kind of Toolset Types custom field, not only single but also repeating ones. We really hope that you enjoy this feature as much as we did while developing that.

Preparation

 
First all, you will need to have Toolset Types installed and also a few custom fields defined for Posts. You can create as many custom fields as you want, single and repeating ones.

 

Adding the Custom Endpoint 

 

Let’s first create our new Route:

 

 

 

We are going to have only one endpoint for this route. So, let’s select the GET method as well as the purpose of the endpoint (Display Posts).

 

 

 

Now, it is time to define the output of the endpoint. For this, let’s select three fields: post_title, locations (custom field) and state_resources (custom field). At this stage it is very important that you pay attention to the custom field names, it must be exactly like the ones you defined once creating those on Toolset Types, do not forget to include the prefix “wpcf-“.

 

 
Ok, at this point everything is ready. Let’s now navigate to the endpoint URL and check if the custom fields are correctly displayed there: wp-json/acme/v1/acf
 

Awesome! All the fields and sub fields defined on ACF are properly displayed!

Conclusion

 

This was just a basic tutorial showing you how easy is to create custom REST API endpoints for your WordPress sites and add some custom fields from Toolset Types. There are many other features and possibilities you can do through the plugin and many new features are coming up soon.

Does this plugin sounds like a good fit for your site? Click here and start building awesome routes for your site now.

Join our 322,204 newsletter subscribers and get the latest news and articles sent straight to your inbox weekly


Rest Routes 5.5.0

Rest Routes 5.5.0 Insert custom URL parameters values on your Custom SQL Query endpoint type and much more… PRO PRICING By Adriano Ferreira New Custom

Read More »

Rest Routes 5.3.0

Rest Routes 5.3.0 Now you are able to perform authenticated requests through Basic Authentication. PRO PRICING By Adriano Ferreira Basic Authentication is not available!  

Read More »

Rest Routes 5.0

Rest Routes 5.0 Write Custom SQL Queries and make HTTP requests PRO PRICING By Adriano Ferreira We are pleased to announce the 5.0 release of

Read More »