{"id":6793,"date":"2019-11-18T10:05:35","date_gmt":"2019-11-18T10:05:35","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=6793"},"modified":"2022-02-11T11:12:24","modified_gmt":"2022-02-11T11:12:24","slug":"wordpress-rest-api-an-introduction","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/","title":{"rendered":"WordPress REST API \u2013 An Introduction"},"content":{"rendered":"<p>The web has grown big over the last decade and WordPress seems to be fallen behind slightly. Several applications are introduced with JavaScript and several dynamic website are built using languages such as Ruby and Python.<\/p>\n<p>The WordPress core developers and a few professional WordPress developers experience that WordPress\u2019s minimum usage of JavaScript and more dependence on PHP has become too old. WordPress REST API has therefore been introduced to solve this issue.<\/p>\n<p>WordPress isn\u2019t going away from PHP but it indicates that developers should learn JavaScript to take the benefits of what API will offer.<\/p>\n<h3>What is API?<\/h3>\n<p>Basically, <strong>API<\/strong> or <strong>Application Programming Interface<\/strong> is a structure of software applications comprising of set of tools and protocols that developers can use to build those applications. In layman\u2019s language, it is a set of standardized methods in which particular software can be used. These are the rules made for interaction with the wider audience which decide the way other pieces of software can communicate with a program and how it will respond.<\/p>\n<p>For example, when a user visits a website, his browser sends a request to the server on which that site is located.<\/p>\n<p>Actually, that server\u2019s API receives the browser\u2019s request, interprets it, and sends back all the data needed to display the site.<\/p>\n<h3>What is REST API?<\/h3>\n<p>The REST API is an old concept. It is defined as<strong> \u201cRepresentational State Transfer\u201d<\/strong> by <strong>Roy Fielding<\/strong> in the year <strong>2000<\/strong> when he designed <strong>HTTP 1.1<\/strong> and <strong>Uniform Resource Identifiers<\/strong> also known as URLs. In simple language, it is a way in which programs can communicate in the simplest possible way.<\/p>\n<p>REST is an HTML-based architecture used for building APIs. In a <strong>RESTful<\/strong> architecture, HTTP requests are used to post, read, update, and delete data between two sources.<\/p>\n<h3>What is JSON REST API?<\/h3>\n<p><strong>JSON<\/strong> or<strong> JavaScript Object Notation<\/strong> is a minimum, text-based data-interchange format used to exchange the data between different platforms seamlessly (though the platforms use different languages).<\/p>\n<p>Generally, JSON is an alternative to XML-based solutions which makes it perfect for mobile apps with limited bandwidth.<\/p>\n<p><strong>Related: <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/json-everything-that-you-want-to-know-about-it\/\" target=\"_blank\" rel=\"noopener\">JSON \u2013 Everything That You Want To Know About It!<\/a><\/strong><\/p>\n<h3>Working of WordPress REST API<\/h3>\n<p>To learn about the working of the WordPress REST API, you need to understand the working of HTTP requests and responses. When a URL is entered in the address bar of a browser, it is a request made. When the server displays the website or application for that URL, it is a response to your request.<\/p>\n<p>There are a few different types of requests or <strong>\u201cHTTP methods\u201d<\/strong> when you start using the WordPress REST API. Check below the four main types of HTTP methods the web uses:<\/p>\n<ul>\n<li><strong>GET \u2013<\/strong> For getting data from the server.<\/li>\n<li><strong>POST \u2013<\/strong> For sending data to the server.<\/li>\n<li><strong>PUT \u2013<\/strong> For changing or updating data on the server.<\/li>\n<li><strong>DELETE \u2013<\/strong> For removing data from the server.<\/li>\n<\/ul>\n<p>Keeping these definitions in mind, when you enter a URL in a browser, it is a GET request. When you enter your login information for a website, it is a POST request. If you change your current password to a new one, it is a PUT request while if you terminate your account, it is a DELETE request.<\/p>\n<p>Other terms you\u2019ll come across are <strong>\u201croutes\u201d<\/strong> and <strong>\u201cendpoints\u201d.<\/strong> A route is basically the URL or a part of the URL you\u2019re trying to access while an endpoint is basically the response you get from the server.<\/p>\n<p>When HTTP requests are sent by external sources to the server hosting your WordPress site, the REST API exposes your data securely by responding to those requests with a common architecture and its own set of protocols.<\/p>\n<p>Due to this WordPress content, such as posts, pages, and comments, is allowed to be processed as raw data. The point is that it allows you to make changes to your site\u2019s content even if you can\u2019t access the WordPress admin area.<\/p>\n<p>This helps you to make changes to your site using JSON whose responses give developers different ways to interact with their sites.<\/p>\n<h3>Understanding the Basics of WordPress REST API<\/h3>\n<p>Below are some concepts about WordPress REST API that you should be aware of:<\/p>\n<ul>\n<li>Routes &amp; Endpoints<\/li>\n<li>Requests<\/li>\n<li>Responses<\/li>\n<li>Schema<\/li>\n<li>Controller Classes<\/li>\n<\/ul>\n<p><strong>Routes &amp; Endpoints<\/strong><\/p>\n<p>In technical terms route is a URL that can be mapped via different HTTPS methods. This mapping between the route and an HTTP method is known as an<strong> \u201cendpoint\u201d<\/strong>. WordPress REST API is accessible and you can check which routes and endpoints are available for your site by including the route<strong> \u201c\/wp-json\/\u201d<\/strong> at the end of the URL.<\/p>\n<p>This can be seen at WordPress.org by visiting https:\/\/www.wordpress.org\/wp-json\/:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6795\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png\" alt=\"\" width=\"550\" height=\"351\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png 550w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor-300x191.png 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/p>\n<p>For <strong>Chrome<\/strong>, you can install an extension called <strong>JSON Viewer<\/strong> (<strong>JSON viewer<\/strong> for <strong>Firefox<\/strong> can be installed from here) to clean this mess up:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6794\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Clean-Guide-To-The-WordPress-REST-API-compressor.png\" alt=\"\" width=\"550\" height=\"350\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Clean-Guide-To-The-WordPress-REST-API-compressor.png 550w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Clean-Guide-To-The-WordPress-REST-API-compressor-300x191.png 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/p>\n<p>In case you don\u2019t use pretty permalinks, use <strong>\u201c?rest_route=\u201d instead of \u201cwp-json\u201d<\/strong>. Whatever you use, you will see here is an example of a route and an endpoint. <strong>\u201c\/wp-json\/\u201d<\/strong> and <strong>\u201c\/?rest_route=\/\u201d<\/strong> are routes. With this, you can access the WordPress REST API through the <strong>GET HTTP<\/strong> method. The WordPress REST API gets displayed to you is an endpoint served to us via a JSON response.<\/p>\n<p><strong>Requests<\/strong><\/p>\n<p>The requests are processed by the WordPress REST API using a class names <strong>WP_REST_Request<\/strong>. It is a primary class in the infrastructure of WordPress REST API. You can store and retrieve information for all the requests made.<\/p>\n<p>Requests can also be sent remotely using the HTTP methods that we saw above or you can make them internally similar to what you do via PHP.<\/p>\n<p><strong>Responses<\/strong><\/p>\n<p>The <strong>WP_REST_Response<\/strong> class is used to process the responses. A response is generally the data you get from a request. This class is used by the API for returning the data sent from endpoints. The result can be errors too.<\/p>\n<p><strong>Schema<\/strong><\/p>\n<p>A concept within the WordPress REST API that serves a variety of purposes is called as schema. API schema identifies the data structures, endpoints can use, and it comprises of a list of the properties the WordPress REST API can return. It also contains the parameters the API can accept and offers security for it by confirming the requests the API receives.<\/p>\n<p><strong>Controller Classes<\/strong><\/p>\n<p>The WordPress REST API handles requests, registers routes and endpoints, utilizes Schema to define the data and properties it can use, and generates API responses on top of all of that. The API as well as you as the developer, needs a way for managing all of these moving parts. Controller classes are available for that. They help you to collect all of these elements and organize them in a single place.<\/p>\n<h3>Steps to Start Using WordPress REST API<\/h3>\n<p><strong>Authentication<\/strong><\/p>\n<p>The first step is to get the authentication \u2013 which is a bit difficult. There are three types of authentications available:<\/p>\n<ul>\n<li><strong>Cookie Authentication \u2013<\/strong> For plugins\/themes that run on the same site.<\/li>\n<li><strong>OAuth \u2013<\/strong> For external clients.<\/li>\n<li><strong>Basic Authentication \u2013<\/strong> For testing only.<\/li>\n<\/ul>\n<p>In this article, we will see the basic auth for the purpose of learning, but make sure you do not use it wildly \u2013 it isn\u2019t very safe at all.<\/p>\n<p>First install the <strong>Basic Auth<\/strong> plugin, available only via <strong>Github<\/strong>. Download the zip and install the zip file in the plugins section.<\/p>\n<p>To showcase the ways to access a WordPress installations API, we are going to use some PHP code on our localhost which will access the metadata of a post on our actual website.<\/p>\n<p>To get the publicly available data you can use the <strong>wp_remote_get()<\/strong> function as below:<\/p>\n<pre class=\"lang:default decode:true\">$response = wp_remote_get( 'http:\/\/danielpataki.com\/wp-json\/wp\/v2\/posts');<\/pre>\n<p>By using the $response variable, you will see a slot of data, including the list of posts. If the same method is used for a restricted resource you\u2019ll get an error: \u201cSorry, you cannot view the meta for this post\u201d. This is where you feel the need for authentication.<\/p>\n<p>With basic auth, we can send our username and password along for each request which will give us the proper privileges.<\/p>\n<pre class=\"lang:default decode:true \">$response = wp_remote_get( 'http:\/\/username:password@example.com\/wp-json\/wp\/v2\/posts\/445\/meta');<\/pre>\n<p>With this, we will be able to see all the post meta related with post 445. The disadvantages of this method should be obvious.<\/p>\n<p>It is required to send your username and password with each request as plain text. Remember this is fine for testing and learning about the API but it shouldn\u2019t be used in production.<\/p>\n<p><strong>Sending Data<\/strong><\/p>\n<p>Certainly, you will get the resources. You can use the GET verb on the proper endpoint to receive back a mass of JSON which you can work with in Javascript directly, or you can use<strong> json_decode()<\/strong> in PHP to convert it to an array.<\/p>\n<p>But when it comes to more complex procedures where we send data, often with parameters, it becomes difficult.<\/p>\n<p><strong>Check the example below that creates a post via the REST API:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">$args['body'] = array(\n'title' =&gt; 'API TEST',\n'status' =&gt; 'draft',\n'content' =&gt; 'content'\n);\n\n$response = wp_remote_post( 'http:\/\/username:password@example.com\/wp-json\/wp\/v2\/posts\/', $args );<\/pre>\n<p>Just taking a glance at the schema will help you know what to add to the request body. It comprises of the parameter names, the data types, the description and context.<\/p>\n<p>In the response you get a bunch of information about our new post, including the ID, which would be easy to use, if we want to manipulate the postmeta once the post added.<\/p>\n<p><strong>Check below the steps to start using WordPress REST API:<\/strong><\/p>\n<p><strong>1. Access the REST API<\/strong><\/p>\n<p>REST API is accessible using any application that can submit HTTP endpoints. For instance, if you enter the below command in your browser, it will result into a list of your WordPress posts in JSON format:<\/p>\n<pre class=\"lang:default decode:true \">GET yourwebsiteurl.com\/wp-json\/wp\/v2\/posts<\/pre>\n<p>Don\u2019t forget to replace the placeholder URL with that of your own website. For a REST API request to work, you\u2019ll need to use a version of WordPress greater than 4.4 (which you already might be using).<\/p>\n<p>For really experimenting with the REST API though, a browser isn\u2019t the best tool. Instead, it is recommended to use the command line for a more flexible approach.<\/p>\n<p><strong>2. Fetch a Specific Post Using the REST API<\/strong><\/p>\n<p>With the above command you might have got a list of all your WordPress posts, along with their post IDs. For fetching a specific post using its ID, you should use an endpoint as below:<\/p>\n<pre class=\"lang:default decode:true \">GET yourwebsiteurl.com\/wp-json\/wp\/v2\/posts\/535<\/pre>\n<p>For instance, this would be needed for showcasing a specific post translated within a mobile application. But, the WordPress REST API helps you to fetch all types of data from WordPress, so its practical applications are extremely flexible.<\/p>\n<p>Let\u2019s say that you wanted to use the REST API for adding metadata to a selected post instead of just fetching it. In other words, using the <strong>POST<\/strong> method rather than <strong>GET<\/strong>.<\/p>\n<p><strong>3. Add Metadata to a Specific Post<\/strong><\/p>\n<p>If you have authenticated yourself, you can add new data to any of your posts with a similar request to that shown in the last section using <strong>POST<\/strong> instead of <strong>GET<\/strong>:<\/p>\n<pre class=\"lang:default decode:true \">POST yourwebsiteurl.com\/wp-json\/wp\/v2\/posts\/535\/meta?value=newmetadata<\/pre>\n<p>For example, in case you want to add metadata that can be used to create a rich snippet for a recipe, the request may look as below:<\/p>\n<pre class=\"lang:default decode:true \">POST yourwebsiteurl.com\/wp-json\/wp\/v2\/posts\/535\/meta?cookingtime=25<\/pre>\n<p>Based on the amount of metadata you want to add, you can specify it using JSON objects instead, which offers a highly structured approach. In any case, once you are known to what the most common endpoints are and how to put them to use, a lot of possibilities arise.<\/p>\n<h3>The Reasons for Using WordPress REST API<\/h3>\n<p>Check below five solid reasons for using WordPress REST API:<\/p>\n<p><strong>1. Cutting the Cord with PHP<\/strong><\/p>\n<p>PHP still <a href=\"https:\/\/w3techs.com\/technologies\/details\/pl-php\" target=\"_blank\" rel=\"nofollow noopener\">powers over 80% of modern websites<\/a>, and is actively endorsed by web giants such as Facebook, and of course WordPress itself.<\/p>\n<p>But in the last decade, there have been enormous advances in other languages such as <strong>Ruby<\/strong>, <strong>Python<\/strong> and <strong>Go<\/strong>, in terms of speed, tooling and available frameworks.<\/p>\n<p>These languages get instant access to the complete range of WordPress\u2019 native functionality with the REST API. This single reason should be enough to get any developer or site owner to think about using REST API.<\/p>\n<p>For getting an instant hold of the potential on offer, you should consider using plugins. Any WordPress plugin today can be perfectly integrated into other frameworks, such as <strong>Ruby on Rails<\/strong> or <strong>Django<\/strong>.<\/p>\n<p>When it comes to the luxury of the WordPress ecosystem and the way its aspects are monetized, the ability to port to brand new platforms is appealing in terms of achievable revenue for developers.<\/p>\n<p><strong>2. True Mobile Integration<\/strong><\/p>\n<p>WordPress has proven to be the best as compared to other content management systems in terms of dealing with the challenge of displaying website on all types of devices (via responsive themes). But, the actual integration with the respective<strong> iOS<\/strong> and <strong>Android<\/strong> apart from the browser remains hard to pin down.<\/p>\n<p>Native WordPress apps help in using the application itself on iOS as well as Android but true third-party integration still remains unachievable.<\/p>\n<p>With REST API, mobile developers will start treating WordPress installs similar to another server, with defined endpoints in terms of their apps. This only fact alone proves WordPress as a possible true backend for native mobile apps and overlays the way for all types of future integrations.<\/p>\n<p>Note that the app usage on mobile remains around the 80% level and this makes it clear that WordPress will need to take a step towards the app environment and this will be possible with the REST API.<\/p>\n<p>While considering the number of websites developed in WordPress that also run independent app versions of their online offerings, there is a high scope for future integration.<\/p>\n<p><strong>3. The Front-End Will Be Strictly Optional<\/strong><\/p>\n<p>This point is wider: the use of the front-end of WordPress will become strictly optional.<\/p>\n<p>When we consider the viewpoint of API, the WordPress front-end is just another external application that hits its endpoints. The allegations of this are large.<\/p>\n<p>WordPress is now just one item that can be easily added to any modern developer\u2019s toolbox without the need of following its templating system, log in or deal with the internal working of WordPress.<\/p>\n<p>You will surely see a revolution in theming and plugin use cases as it will have a positive impact on developers and site owners globally.<\/p>\n<p><strong>4. The WordPress Backend is Ready to Be Reimagined<\/strong><\/p>\n<p>Since making changes to the core WordPress website was only possible via admin account, it kept other users dependent on the admin for even small changes.<\/p>\n<p>But, REST API has opened the doors to the core WordPress and the developers can now take their own decision on it instead of just customizing it.<\/p>\n<p>One of the example of this it WordPress.com\u2019s unique take on the admin panel \u2013 though that is powered by the separate WordPress.com API.<\/p>\n<p><strong>5. Getting on Board the Javascript Bandwagon<\/strong><\/p>\n<p>At this stage, we can say that Javascript is ruling the world.<\/p>\n<p>As mentioned above, the frameworks &#8211; <strong>Rails<\/strong> and <strong>Django<\/strong> are rising but the actual one used in the last five years is JavaScript.<\/p>\n<p>The rise of Node.js on the server-side with the combination of a new breed of front-end frameworks such as <strong>Backbone<\/strong>, <strong>Angular JS<\/strong>, <strong>Ember<\/strong> and <strong>React<\/strong>, have positioned JavaScript in front and center.<\/p>\n<p>WordPress has become a potential partner with these technologies with the REST API instead of a competitor. When considering the support for <strong>Angular JS<\/strong> and <strong>React<\/strong>, this is a smart position to consider.<\/p>\n<p>So, now the developers and theme designers can freely explore the new technologies together along with sharpening their existing WordPress skills.<\/p>\n<p>With this, you will get a complete idea about WordPress REST API.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The web has grown big over the last decade and WordPress seems to be fallen behind slightly. Several applications are introduced with JavaScript and several dynamic website are built using languages such as Ruby and Python. The WordPress core developers and a few professional WordPress developers experience that WordPress\u2019s minimum usage of JavaScript and more [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[1097,78,1096],"class_list":["post-6793","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-wordpress-faq","tag-what-is-wordpress-rest-api","tag-wordpress-2","tag-wordpress-rest-api"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WordPress REST API \u2013 An Introduction<\/title>\n<meta name=\"description\" content=\"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress REST API \u2013 An Introduction\" \/>\n<meta property=\"og:description\" content=\"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-18T10:05:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-11T11:12:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/\",\"name\":\"WordPress REST API \u2013 An Introduction\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png\",\"datePublished\":\"2019-11-18T10:05:35+00:00\",\"dateModified\":\"2022-02-11T11:12:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png\",\"contentUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png\",\"width\":550,\"height\":351},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress REST API \u2013 An Introduction\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress REST API \u2013 An Introduction","description":"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/","og_locale":"en_GB","og_type":"article","og_title":"WordPress REST API \u2013 An Introduction","og_description":"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2019-11-18T10:05:35+00:00","article_modified_time":"2022-02-11T11:12:24+00:00","og_image":[{"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png","type":"","width":"","height":""}],"author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Estimated reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/","name":"WordPress REST API \u2013 An Introduction","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png","datePublished":"2019-11-18T10:05:35+00:00","dateModified":"2022-02-11T11:12:24+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"The article describes everything you want to know about WordPress Rest API alogn with the reasons to use WordPress REST API.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#primaryimage","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png","contentUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/11\/WordPress-WP-Json-Guide-To-The-WordPress-REST-API-compressor.png","width":550,"height":351},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wordpress-rest-api-an-introduction\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"WordPress REST API \u2013 An Introduction"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/"}]}},"views":664,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=6793"}],"version-history":[{"count":4,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6793\/revisions"}],"predecessor-version":[{"id":13244,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6793\/revisions\/13244"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=6793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=6793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=6793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}