Categories
Uncategorized

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…

By Adriano Ferreira

New Custom URL Parameters in Custom SQL and Pagination

 

We are pleased to announce the 5.5.0 version of Rest Routes Pro. This time we’ve launched 2 very interesting features.


Custom SQL and URL Parameters

 

So far, with Custom SQL Query endpoint you were able to only use static SQL queries, so no chance to have something external to interact with the query. This is in the past now! You are able to insert custom URL parameters that you previously defined on your endpoint directly on your query.


For this, all you need is to wrap it with the placeholder, like %my_parameter%. So, your custom SQL query could look like this: “SELECT * FROM wp_posts WHERE ID = %post_id%”.


When you do this, internally, we will look for URL get parameter called post_id and replace the query placeholder with the get parameter value. Awesome, isn’t it?


Pagination Added

 
Before, it was kind of a nightmare to add pagination for your endpoints, you had to play with limit + offset and the offset value didn’t reflect the actual page number. This also is in the past now!


We’ve added a section inside of “Limit and Offset” where you are able to define how we will find the current page number, we recommend to add a custom parameter (you can even use the helper button we’ve included for this) and then connect the Source field of the Page Number group with this custom parameter. Also, define how many items per page you would like to show.


After doing this, you will be able to use your endpoint pagination like this: http://example.dev/wp-json/namespace/my-route?page=2

 

We hope you truly enjoy this version and as always, please report any bugs you might find to hello@restroutes.com.


Happy New Year!!!

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 »
Categories
Uncategorized

Rest Routes 5.3.0

Rest Routes 5.3.0

Now you are able to perform authenticated requests through Basic Authentication.

By Adriano Ferreira

Basic Authentication is not available!

 

One of the most asked features is now available! Until today, you would need an external plugin in order to performer Basic Authenticated requests. From now on, it comes within Rest Routes Pro.

This means, that you can perform basic authenticated requests using WordPress username and password:

 

curl –user admin:password https://example.com/wp-json/my-route

 

We really hope that you enjoy this release! If you find any issue with this version, please write an email to hello@restroutes.com or use the form in the plugin menu on WordPress dashboard.

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 »
Categories
Uncategorized

Rest Routes 5.0

Rest Routes 5.0

Write Custom SQL Queries and make HTTP requests

By Adriano Ferreira

We are pleased to announce the 5.0 release of Rest Routes. We have been cooking this release for a long time and it is finally ready! We have fixed a bunch of bugs as well as introduced a couple of really exciting features.

Custom SQL Queries

For everyone who was waiting for this feature, it is finally out! You have a fancy new endpoint type that lets you write custom SQL queries and output the results in the endpoint output. You can do any kind of advanced SQL query.


Documentation: How to create a custom endpoint with custom SQL queries


REST API Call

This is another advanced endpoint type that has been introduced in this version. You will be able to through your custom endpoint make HTTP calls to external endpoints.


Documentation: How to create a custom endpoint for making external HTTP request calls


Conditional Display of Fields

We added the possibility now to conditionally output some fields, depending on certain settings.


Documentation: How to conditionally output some fields in a custom endpoint


Enhanced Support to ACF

We know that many of our clients are using ACF, for this we have extended the compatibility we have with ACF. You should be able to do everything that you need with both single fields and repeating ones: custom field filtering, editing, and creation.


We wrote better documentation about the integration we have with ACF, you can find it here.


UX improvements

We have added 2 important elements that should help you to manage the settings of your custom endpoints.


Now, you will find 2 new buttons in the field section of output and filter areas. One button will let you change the order of the field in the output, so you have 2 arrows to change the order.


The other button will let you collapse the field area, so you don’t need to keep seeing the configuration of all fields that you have in the endpoint. That gives you more focus on which field you are currently working on.


We hope you love this version as much as we loved creating it. Let us know what you think about it!


Adriano Ferreira

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 »
Categories
Uncategorized

Rest Routes 4.23.0

Rest Routes 4.23.0

By Adriano Ferreira

Rest Routes 4.23.0

 

We are pleased to announce the 4.23.0 release of Rest Routes. We’ve done a very short development cycle with just a few features and bugs fixed. Find below the complete change log:

 

FREE/PRO: Fixed problem with malformed strings in endpoint
FREE/PRO: Fixed problem with fixed filter values
FREE/PRO: Fixed problem with the URL of fresh custom endpoints when saving
FREE/PRO: Fixed bug in the enqueuing of Rest Routes scripts
FREE/PRO: Fixed bug in the Save button on RTL
PRO: Added filter for changing the custom table database
PRO: Added parent fields as output options

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 »
Categories
Uncategorized

Rest Routes 4.0

Rest Routes 4.0 is out!

Today is the day that we will be bringing to you some of the most asked features ever. Please take a sit, a couple of coffee and be ready for some really cool stuff.

By Adriano Ferreira

Rest Routes 4.0 is out and is a truly game changer!

 

We are very proud to announce Rest Routes 4.0 today. The reason is that we’ve been working on some really cool stuff that many of you have been waiting for.

We will be introducing custom endpoints for users and a complete CRUD for custom tables endpoints.

 

Custom endpoints for Users and User meta fields

 

We’ve introduced 3 types of endpoints for users:

 

  • Users creation
  • Users editing
  • Users display
 

Now, you will be able to create custom endpoints for displaying, editing, and creating users. Any of those new endpoints work also with user meta fields.

 

See some screenshots below:

New custom endpoints for custom tables

 

We’ve introduced 3 more types of endpoints for custom tables:

 

  • Create custom table items
  • Edit custom table items
  • Delete custom table items
 

Now, you will be able to create custom endpoints for creating, editing and deleting custom table items.

 

See some screenshots below:

Besides those we’ve done a couple of other stuff:

 

  • Introduced permalink as an output field for posts
  •  Several UI changes for improving the user experience
  • Security fixes
  • Fixed issue with terms filter
  • Fixed the permission of some internal routes
  • Added option to choose whether you want to append or not terms when creating posts
 
We really hope that you will enjoy this release as much as we did while developing that. If you have any question or suggestion please drop us a message to hello@restroutes.com.

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 »
Categories
Uncategorized

Rest Routes 3.6.0

Rest Routes 3.6.0

We’ve introduced a very interesting feature on this release. Now you will be able to create custom endpoints for editing posts, taxonomies and custom fields.

By Adriano Ferreira

Rest Routes 3.6.0

 

We are pleased to announce the 3.6.0 release of Rest Routes Pro. We’ve done a very short development cycle with just a few features and bugs fixed.

 

There is a major feature that we’ve introduced which is a new endpoint type, the Edit Post. Yeah, now you will be able to create custom endpoints for editing posts.

 

Not only that, but you will also be able to edit or add custom fields and taxonomies that are attached to your custom post.

 

 

See below a summary of what you will find on this release:

 

  • Feature: New endpoint type, Edit Post
  • Feature: Added the new post ID in the response of the Create Post endpoint type
  • Fix: Fixed an issue with the hide_empty taxonomy filter
  • Fix: Fixed issue when using the Display Custom Tables type which was not displaying all database tables in some MySQL versions

 

We really hope that you enjoy this release! If you find any issue with this version, please write an email to hello@restroutes.com or use the form in the plugin menu on WordPress dashboard.

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 »
Categories
Uncategorized

How to display Toolset custom fields with Rest Routes

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 »
Categories
Uncategorized

How to create custom endpoints for ACF Pro custom fields

How to create custom endpoints for ACF Pro custom fields

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

By Adriano Ferreira

Rest Routes and ACF 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 ACF and ACF Pro for building custom fields, we’ve decided to integrate it with our Pro plugin. Now, you can easily expose ACF custom fields through your custom endpoints built with Rest Routes Pro.

You will be able to display any kind of ACF 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 ACF and ACF Pro 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 ACF.

 

 
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 ACF Pro. 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 »
Categories
Uncategorized

How to create custom endpoints for custom tables on WordPress

How to create custom endpoints for custom tables on WordPress

In this post we are going to show you how easy is to create custom endpoints for any custom database table on WordPress through Rest Routes Pro

By Adriano Ferreira

Custom Post Types and the Power of WordPress

 

One of the great things on WordPress is its extensibility, this is a fact. You can extend it through plugins, themes leveraging the power of it. Another thing that you can easily extend on WordPress is the custom post types.

 

Creating custom post types is something that takes WordPress to a whole new level of customization in terms of CMS features. You are not limited to posts and pages.

 

 

The downsides of keeping everything on native WordPress tables

 

So you may think, why do I need custom database tables when I can create infinite custom post types for my site? The answer is pure and simple, performance!

 

If you had the opportunity to work with some large WordPress database, you may have noticed that the tables responsible for storing posts (posts and postmeta) can become monsters in terms of size.

 

It is not rare that when working with those large database tables, you may need to do some SQL queries using LEFT JOIN or RIGHT JOIN and this can be a total disaster.

 

Some things you can do to resolve that problem:

 

  • Partition your database table in some pieces: the problem with this approach is that it becomes a nightmare and sometimes impossible to do SQL JOINs
  • Create some replicas: this helps with the SELECT operations as you can spread the load between the slaves, however, you still have to run UPDATE and DELETE in the master replica
  • Create custom tables for different purposes and that’s what we are going to discuss now

Custom REST endpoints for custom database tables

 

I’m not going to detail the creation of custom tables on WordPress, you can have a look at the official documentation to understand all the details.
 
We are going to focus on the creation of custom endpoints for already created custom tables through Rest Routes Pro.

Defining our custom endpoint for the custom WordPress table

 

First of all, let’s create our new route giving it a namespace and a route name:

Now we have the select the right method for this which is going to be the GET.

Also choose the endpoint purpose which is “Display Custom Table Entries” as you can see below:

Let’s also add some custom parameters that in the future will help us to refine the search results of our custom endpoint:

Now we are going to select a table we’ve previously created, “cars”:

Select now the “Filter Columns” tab and let’s now add some filters accordingly to the image below. This will let us refine the search using all the custom parameters that we’ve previously created, name, year and color:

In the Endpoint Output section, let’s add name, year and color as fields to be exposed by the endpoint:

Save it and it is done! You custom endpoint for the cars custom WordPress table is now available. Let’s access it like shown in the image below:

You should see all the cars stored in the cars table, like the image above.

Now let’s refine our search as the image below:

Nice! The filters worked just fine!

Feel free to go back in the editing page and play with some other options, like Limit & Offset and Ordering.

Conclusion

 

We’ve just created a custom REST endpoint for an arbitrary custom WordPress database table. Now, you are able to expose routes for any kind of table, not only WordPress default tables anymore. I hope you enjoy this feature as much as we did while developing it.

 

 

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 »
Categories
Uncategorized

WordPress Plugin Skeleton

WordPress Plugin Skeleton

A simple starting point for developing WordPress plugins

By Adriano Ferreira

Starting a new plugin can be a hassle! Many default files to define, configuration files, folders, etc. Doing that repeatedly can be even worse. Knowing that and also by the fact that a great part of our subscribers are WordPress developers, we’ve decided to release a simple WordPress Skeleton Plugin as open-source to help you when building new WordPress plugins.

 

What comes in:

 

  • File structure based on WordPress.org recommendations
  • Composer configured
  • PHPUnit settings defined
  • Twig added and a Loader class for it
  • Travis settings defined
  • A hook class sample
  • Make commands for building, testing and developing
 

It is available in both GitHub and Composer Packagist.

Installation

It’s recommended that you use Composer to install this library.

 

  • Create an empty folder inside of “wp-content/plugins” and name it as your plugin name
  • Enter inside of it through terminal and run the command:

$ composer create-project adrianoferreira/wp-plugin-skeleton:dev-master

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 »