Significance of WordPress 4.7 Web Services
- July 21, 2017
- Leave a comment
Web Services is a method of communication between website and other electronic devices over a network. In web services, you make a software that receives request (s) in a specific pattern (mostly in the form of URLs) and then sends a response accordingly. Mostly, web services are used to synchronize data of two different platforms or display dynamic content on apps and so on.
Web service is the latest technology and a need of application development. So by keeping all these parameters in view, WordPress introduced built-in web services functionality for some of its basic features like posts, comments, terms, users, Meta and settings in its 4.7 version. It also provide guidelines to add new endpoints in it for other purposes.
WordPress 4.7 includes REST API in it as a core functionality so there is no need to add a separate plugin to achieve this functionality. After that, WordPress shifted towards a full application framework. WordPress REST API is easy to understand and use.
It provides you easy-to-use set of HTTP endpoints that provides access to your site’s data in simple JSON format. You can also add new HTTP endpoints into it. Here is the list of built-in HTTP endpoints:
- Posts -> /wp/v2/posts
- Post Revisions -> /wp/v2/revisions
- Categories -> /wp/v2/categories
- Tags -> /wp/v2/tags
- Pages -> /wp/v2/pages
- Comments -> /wp/v2/comments
- Taxonomies -> /wp/v2/taxonomies
- Media -> /wp/v2/media
- Users -> /wp/v2/users
- Post Types -> /wp/v2/types
- Post Statuses -> /wp/v2/statuses
- Settings -> /wp/v2/settings
WordPress 4.7 also provide hooks to add new HTTP endpoints. To add a new endpoint, use the following Hook:
You can call this hook with callback function which have the following parameters:
- Array of method and callback function to return values
As a result, it will return a JSON data object (returned by the callback function).