REST API

The REST API has come a long way since it was added to WordPress Core. Using the REST API, you can build frontend applications powered by WordPress as the backend.

Using WordPress as a headless CMS is also a breeze with the REST API. More information on this topic can be found at Headless WordPress: The Ups And Downs Of Creating A Decoupled WordPress from Smashing Magazine and the β€˜Decoupled’ lesson under the Extras chapter.

You can also use REST API endpoints to get data directly from WordPress and display it using any front-end language or framework.

Also, check out the WP-REST API Handbook.

Default REST-API Endpoints

You can have a look at all the default REST-API endpoints over here – Rest API Reference.

Creating custom endpoints

If needed, you can also create custom endpoints.

Admin AJAX vs REST API

Since the REST API is comparatively new and offers better performance than admin-ajax.php, developers are now moving away from AJAX to REST API. You can read more about how they differ from the below resources:

For detailed examples comparing AJAX API and REST API side-by-side, see WordPress AJAX.