[Vuejs]-WordPress with vuejs how to link to site pages

0👍

WordPress provides a REST API interface that can be used to get Posts and other content from a WordPress Website in JSON Format. You can then manipulate that JSON however you feel like.

The rest API can be accessed at,

https://example.url/wp-json             -> Gives all available namespaces for the API.
https://example.url/wp-json/wp/v2/      -> The built-in WordPress API Namespace. Contains all built-in routes for posts, pages, users, etc.

The Posts and Pages can be accessed at,

https://example.url/wp-json/wp/v2/posts  -> Access all Publicly published posts
https://example.url/wp-json/wp/v2/pages  -> Access all Publicly published pages

You can find more routes over at the REST API Handbook  -> Link given below.

You can use the following GET url to get a post with a certain slug

https://example.url/wp-json/wp/v2/posts?slug=post-slug  -> This will return a post with the given slug
https://example.url/wp-json/wp/v2/posts?author=1        -> This will return all posts published by an author with the Author Id of 1

You can read more about the WordPress Rest API over at the REST API Handbook provided by WordPress Developers.

Leave a comment