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.
You can have a look at all the default REST-API endpoints over here β Rest API Reference.
If needed, you can also create custom endpoints.
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.