{"id":5186,"date":"2021-01-14T19:56:37","date_gmt":"2021-01-15T01:56:37","guid":{"rendered":"http:\/\/localhost:3000\/?p=29"},"modified":"2023-04-19T08:53:51","modified_gmt":"2023-04-19T14:53:51","slug":"introduction-to-the-wordpress-rest-api","status":"publish","type":"post","link":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/","title":{"rendered":"Introduction To The WordPress REST API"},"content":{"rendered":"\n<p>In the modern age of frontend development developers need flexibility in what tools they can use to implement their frontend websites and apps. Prior to the release of the WordPress REST API separating your frontend from WordPress would be a daunting task. With the release of the REST API, WordPress is paving the way for a better future for developers. If you have worked with a REST API before then it shouldn&#8217;t be too difficult to get started with the WordPress REST API. If you are new to REST APIs or APIs in general, let&#8217;s get acquainted with them before we dive into the WordPress REST API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is A REST API?<\/h2>\n\n\n\n<p>An <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/API\" data-type=\"URL\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/API\" target=\"_blank\">Application Programming Interface<\/a>, or API, defines a way for multiple computing platforms to communicate. It allows for a computing platform (e.g. a frontend website) to make requests and receive data from another system. The API defines how the requests should be made, what the format of the data will look like, and any conventions that are needed. A REpresentational State Transfer API, or REST API, is a special style of API that comes with a common architecture and patterns used in web services. RESTful web services provide interoperability between web computing platforms over the internet. REST APIs provide URL endpoints where you can request information from a system. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The WordPress REST API<\/h2>\n\n\n\n<p>The WordPress REST API provides URL endpoints to request different objects from WordPress such as posts, pages, settings, taxonomies, etc. Transactions with the WordPress REST API are done using <a rel=\"noreferrer noopener\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn\/JavaScript\/Objects\/JSON\" data-type=\"URL\" data-id=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn\/JavaScript\/Objects\/JSON\" target=\"_blank\">JSON<\/a>, making it easy for JavaScript applications in particular to interact with the API. JavaScript is not a requirement to interact with the API, you can use any language that can make HTTP requests. In general, when you are building a client application separate from WordPress and you want to use some data from WordPress you will need to utilize the REST API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using the WordPress REST API<\/h2>\n\n\n\n<p>Let&#8217;s take a look at the WordPress REST API using only our browser. The simplest request you can make is a <code>GET<\/code> request to <code>yoursite.com\/wp-json\/<\/code>. For example, for my test site I use <a rel=\"noreferrer noopener\" href=\"https:\/\/localwp.com\/\" data-type=\"URL\" data-id=\"https:\/\/localwp.com\/\" target=\"_blank\">Local<\/a>, a popular developer tool for running local WordPress sites. I have my local WordPress site as <code>http:\/\/mysite.local\/<\/code>. If I go to <code>http:\/\/mysite.local\/wp-json\/<\/code> I see a JSON response showing me a few things:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Some general information about my site (i.e. name, description, url)<\/li><li>What API routes are available<\/li><li>What endpoints are available for each route<\/li><\/ol>\n\n\n\n<p>The root <code>GET<\/code> requests actually returns all of the available API routes. If you look closely you will see one route called <code>\/wp\/v2\/posts<\/code>. This route is the list posts endpoint. Making a <code>GET<\/code> request to this route will return all of the published posts for the site. I have my site setup with a test post so I can see it in action. Let&#8217;s visit this route (i.e. <code>http:\/\/mysite.local\/wp-json\/wp\/v2\/posts<\/code>) and make a <code>GET<\/code> request to see what it returns:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json shcb-code-table shcb-line-numbers\"><span class='shcb-loc'><span>&#91;\n<\/span><\/span><span class='shcb-loc'><span>  {\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"id\"<\/span>: <span class=\"hljs-number\">26<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"date\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"date_gmt\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"modified\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"modified_gmt\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"slug\"<\/span>: <span class=\"hljs-string\">\"test-post-please-ignore\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"status\"<\/span>: <span class=\"hljs-string\">\"publish\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"type\"<\/span>: <span class=\"hljs-string\">\"post\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"link\"<\/span>: <span class=\"hljs-string\">\"http:\/\/mysite.local\/test-post-please-ignore\/\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"title\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>      <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"Test Post, Please Ignore\"<\/span>\n<\/span><\/span><span class='shcb-loc'><span>    },\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"content\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>      <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"&lt;p&gt;This is a test post.&lt;\/p&gt;\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>      <span class=\"hljs-attr\">\"protected\"<\/span>: <span class=\"hljs-literal\">false<\/span>\n<\/span><\/span><span class='shcb-loc'><span>    },\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"excerpt\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>      <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"&lt;p&gt;This is a test post.&lt;\/p&gt;\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>      <span class=\"hljs-attr\">\"protected\"<\/span>: <span class=\"hljs-literal\">false<\/span>\n<\/span><\/span><span class='shcb-loc'><span>    },\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"_links\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>        <span class=\"hljs-attr\">\"self\"<\/span>: &#91;{\n<\/span><\/span><span class='shcb-loc'><span>            <span class=\"hljs-attr\">\"href\"<\/span>: <span class=\"hljs-string\">\"http:\/\/mysite.local\/wp-json\/wp\/v2\/posts\/26\"<\/span>\n<\/span><\/span><span class='shcb-loc'><span>        }]\n<\/span><\/span><span class='shcb-loc'><span>    }\n<\/span><\/span><span class='shcb-loc'><span>  }\n<\/span><\/span><span class='shcb-loc'><span>]\n<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>I took the liberty of reducing some of the fields in the response to make it easier to view. Notice the response is a list of posts, and will return multiple posts if you have more than one. Each posts has a standard set of fields such as title, content, excerpt, slug, etc.<\/p>\n\n\n\n<p>If you notice in the JSON response above there is also a &#8220;link&#8221; to the API endpoint for the post. Making a <code>GET<\/code> request to the link will return the individual post data as shown below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json shcb-code-table shcb-line-numbers\"><span class='shcb-loc'><span>{\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"id\"<\/span>: <span class=\"hljs-number\">26<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"date\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"date_gmt\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"modified\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"modified_gmt\"<\/span>: <span class=\"hljs-string\">\"2020-12-18T20:37:13\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"slug\"<\/span>: <span class=\"hljs-string\">\"test-post-please-ignore\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"status\"<\/span>: <span class=\"hljs-string\">\"publish\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"type\"<\/span>: <span class=\"hljs-string\">\"post\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"link\"<\/span>: <span class=\"hljs-string\">\"http:\/\/mysite.local\/test-post-please-ignore\/\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"title\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"Test Post, Please Ignore\"<\/span>\n<\/span><\/span><span class='shcb-loc'><span>  },\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"content\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"\\n&lt;p&gt;This is a test post.&lt;\/p&gt;\\n\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"protected\"<\/span>: <span class=\"hljs-literal\">false<\/span>\n<\/span><\/span><span class='shcb-loc'><span>  },\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"excerpt\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"rendered\"<\/span>: <span class=\"hljs-string\">\"&lt;p&gt;This is a test post.&lt;\/p&gt;\\n\"<\/span>,\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"protected\"<\/span>: <span class=\"hljs-literal\">false<\/span>\n<\/span><\/span><span class='shcb-loc'><span>  },\n<\/span><\/span><span class='shcb-loc'><span>  <span class=\"hljs-attr\">\"_links\"<\/span>: {\n<\/span><\/span><span class='shcb-loc'><span>    <span class=\"hljs-attr\">\"self\"<\/span>: &#91;\n<\/span><\/span><span class='shcb-loc'><span>      {\n<\/span><\/span><span class='shcb-loc'><span>        <span class=\"hljs-attr\">\"href\"<\/span>: <span class=\"hljs-string\">\"http:\/\/mysite.local\/wp-json\/wp\/v2\/posts\/26\"<\/span>\n<\/span><\/span><span class='shcb-loc'><span>      }\n<\/span><\/span><span class='shcb-loc'><span>    ]\n<\/span><\/span><span class='shcb-loc'><span>  }\n<\/span><\/span><span class='shcb-loc'><span>}\n<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note the above response is the same as what is returned for the list of posts, but this time only a single post object is returned rather than a list. Looking at the endpoint you notice that we are making the request for the post using its <code>id<\/code> property. While this works, it isn&#8217;t ideal for a few reasons. Applications typically use URLs to determine what request to  make. So if you have a single post page on your site at <code>\/posts\/{id}<\/code> you will be able to get the <code>id<\/code> of the post from the URL and use it to make a <code>GET<\/code> request to your WordPress site. However, this requires your URLs to have numeric IDs when what you really want is prettier URLs that contain the post <code>slug<\/code>. WordPress allows you to make requests for posts based on <code>slug<\/code> (and many other fields for that matter) using the list posts endpoint. For example, to get the post above using the <code>slug<\/code> we can make a <code>GET<\/code> request to <code>http:\/\/mysite.local\/wp-json\/wp\/v2\/posts?slug=test-post-please-ignore<\/code>. This will return a list of one post with our requested post in it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pagination Using the WordPress REST API<\/h2>\n\n\n\n<p>By default, the list posts API endpoint will only return the latest 10 posts. As your site grows to eventually have more than 10 posts, you will need to customize your API queries to allow for paginating these posts. You can request up to 100 posts at a time from WordPress using a <code>per_page<\/code> query parameter, but note that larger queries can hurt your site performance. Let&#8217;s take a look at a couple query parameters that are useful for paginating your WordPress posts.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>?page=<\/code>: This parameter specifies which page of results you want (e,g. <code>\/wp\/v2\/posts?page=2<\/code> will give you the second page of posts)<\/li><li><code>?per_page=<\/code>: This parameter (from 1 to 100) specifies how many posts you want in a page<\/li><li><code>?offset=<\/code>: This parameter specifies a numeric offset at which to start your page of posts. So <code>?page=2<\/code> is the same as <code>?offset=10<\/code><\/li><\/ul>\n\n\n\n<p>When writing your frontend code to utilize pagination you have a couple options. Sometimes you simply want include <code>next<\/code> and <code>previous<\/code> links to allow a user to navigate. Other times you want the user to be able to click to a specific page. Depending on your needs you might use the <code>page<\/code> query or the <code>offset<\/code> query, but you will also need to know how many pages and\/or posts your WordPress site has so you can properly display your pagination controls to you user. To address this, every request you make to the list posts API endpoint returns the following two response headers:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>X-WP-Total<\/code>: The total number of posts based on the requested parameters<\/li><li><code>X-WP-TotalPages<\/code>: The total number of pages based on the requested parameters<\/li><\/ul>\n\n\n\n<p>Using the above headers you can accurately determine if there are more pages available to request as well as how many more pages and posts exist.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Should You Use the WordPress REST API?<\/h2>\n\n\n\n<p>The WordPress REST API is a great starting point if you are attempting to move to use WordPress as a headless CMS. However, the REST API is fairly complicated for a lot of use-cases. Many people use the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.wpgraphql.com\/\" data-type=\"URL\" data-id=\"https:\/\/www.wpgraphql.com\/\" target=\"_blank\">WPGraphQL<\/a> plugin, which enabled a more user-friendly GraphQL API on top of WordPress. We recommend giving both a shot and seeing which works best for you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Further Reading<\/h2>\n\n\n\n<p>If you like working with the WordPress REST API and you want to learn more, check out the <a rel=\"noreferrer noopener\" href=\"https:\/\/developer.wordpress.org\/rest-api\/\" data-type=\"URL\" data-id=\"https:\/\/developer.wordpress.org\/rest-api\/\" target=\"_blank\">REST API Handbook<\/a>.<\/p>\n\n\n\n<p>Check out our other posts to learn about using <a href=\"http:\/\/introduction-to-graphql-in-wordpress\" data-type=\"URL\" data-id=\"introduction-to-graphql-in-wordpress\" target=\"_blank\" rel=\"noreferrer noopener\">GraphQL to access the WordPress API<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the modern age of frontend development developers need flexibility in what tools they can use to implement their frontend websites and apps. Prior to the release of the WordPress [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":34,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_EventAllDay":false,"_EventTimezone":"","_EventStartDate":"","_EventEndDate":"","_EventStartDateUTC":"","_EventEndDateUTC":"","_EventShowMap":false,"_EventShowMapLink":false,"_EventURL":"","_EventCost":"","_EventCostDescription":"","_EventCurrencySymbol":"","_EventCurrencyCode":"","_EventCurrencyPosition":"","_EventDateTimeSeparator":"","_EventTimeRangeSeparator":"","_EventOrganizerID":[],"_EventVenueID":[],"_OrganizerEmail":"","_OrganizerPhone":"","_OrganizerWebsite":"","_VenueAddress":"","_VenueCity":"","_VenueCountry":"","_VenueProvince":"","_VenueState":"","_VenueZip":"","_VenuePhone":"","_VenueURL":"","_VenueStateProvince":"","_VenueLat":"","_VenueLng":"","_VenueShowMap":false,"_VenueShowMapLink":false,"footnotes":""},"categories":[23],"tags":[],"class_list":["post-5186","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-headless"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Introduction To The WordPress REST API - Builders<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction To The WordPress REST API - Builders\" \/>\n<meta property=\"og:description\" content=\"In the modern age of frontend development developers need flexibility in what tools they can use to implement their frontend websites and apps. Prior to the release of the WordPress [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Builders\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-15T01:56:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-19T14:53:51+00:00\" \/>\n<meta name=\"author\" content=\"Will Johnston\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wpebuilders\" \/>\n<meta name=\"twitter:site\" content=\"@wpebuilders\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Will Johnston\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/\"},\"author\":{\"name\":\"Will Johnston\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/person\\\/12c2a773cdc5451ead7cb8c7f2f1fd83\"},\"headline\":\"Introduction To The WordPress REST API\",\"datePublished\":\"2021-01-15T01:56:37+00:00\",\"dateModified\":\"2023-04-19T14:53:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/\"},\"wordCount\":1150,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"Headless\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/\",\"name\":\"Introduction To The WordPress REST API - Builders\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2021-01-15T01:56:37+00:00\",\"dateModified\":\"2023-04-19T14:53:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/introduction-to-the-wordpress-rest-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction To The WordPress REST API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\",\"name\":\"Builders\",\"description\":\"Reimagining the way we build with WordPress.\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#organization\",\"name\":\"WP Engine\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/WP-Engine-Horizontal@2x.png\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/WP-Engine-Horizontal@2x.png\",\"width\":348,\"height\":68,\"caption\":\"WP Engine\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/wpebuilders\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCh1WuL54XFb9ZI6m6goFv1g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/#\\\/schema\\\/person\\\/12c2a773cdc5451ead7cb8c7f2f1fd83\",\"name\":\"Will Johnston\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g\",\"caption\":\"Will Johnston\"},\"url\":\"https:\\\/\\\/wpengine.com\\\/builders\\\/author\\\/wjohnsto\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Introduction To The WordPress REST API - Builders","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:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/","og_locale":"en_US","og_type":"article","og_title":"Introduction To The WordPress REST API - Builders","og_description":"In the modern age of frontend development developers need flexibility in what tools they can use to implement their frontend websites and apps. Prior to the release of the WordPress [&hellip;]","og_url":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/","og_site_name":"Builders","article_published_time":"2021-01-15T01:56:37+00:00","article_modified_time":"2023-04-19T14:53:51+00:00","author":"Will Johnston","twitter_card":"summary_large_image","twitter_creator":"@wpebuilders","twitter_site":"@wpebuilders","twitter_misc":{"Written by":"Will Johnston","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#article","isPartOf":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/"},"author":{"name":"Will Johnston","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/person\/12c2a773cdc5451ead7cb8c7f2f1fd83"},"headline":"Introduction To The WordPress REST API","datePublished":"2021-01-15T01:56:37+00:00","dateModified":"2023-04-19T14:53:51+00:00","mainEntityOfPage":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/"},"wordCount":1150,"commentCount":0,"publisher":{"@id":"https:\/\/wpengine.com\/builders\/#organization"},"image":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#primaryimage"},"thumbnailUrl":"","articleSection":["Headless"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/","url":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/","name":"Introduction To The WordPress REST API - Builders","isPartOf":{"@id":"https:\/\/wpengine.com\/builders\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#primaryimage"},"thumbnailUrl":"","datePublished":"2021-01-15T01:56:37+00:00","dateModified":"2023-04-19T14:53:51+00:00","breadcrumb":{"@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/builders\/introduction-to-the-wordpress-rest-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/builders\/"},{"@type":"ListItem","position":2,"name":"Introduction To The WordPress REST API"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/builders\/#website","url":"https:\/\/wpengine.com\/builders\/","name":"Builders","description":"Reimagining the way we build with WordPress.","publisher":{"@id":"https:\/\/wpengine.com\/builders\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/builders\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpengine.com\/builders\/#organization","name":"WP Engine","url":"https:\/\/wpengine.com\/builders\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/logo\/image\/","url":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/2024\/05\/WP-Engine-Horizontal@2x.png","contentUrl":"https:\/\/wpengine.com\/builders\/wp-content\/uploads\/2024\/05\/WP-Engine-Horizontal@2x.png","width":348,"height":68,"caption":"WP Engine"},"image":{"@id":"https:\/\/wpengine.com\/builders\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/wpebuilders","https:\/\/www.youtube.com\/channel\/UCh1WuL54XFb9ZI6m6goFv1g"]},{"@type":"Person","@id":"https:\/\/wpengine.com\/builders\/#\/schema\/person\/12c2a773cdc5451ead7cb8c7f2f1fd83","name":"Will Johnston","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/711cc598460b8cfa41e03d26343818356d4c0560269da54d2ac27bece492cd50?s=96&d=mm&r=g","caption":"Will Johnston"},"url":"https:\/\/wpengine.com\/builders\/author\/wjohnsto\/"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts\/5186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/comments?post=5186"}],"version-history":[{"count":0,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/posts\/5186\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/media?parent=5186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/categories?post=5186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpengine.com\/builders\/wp-json\/wp\/v2\/tags?post=5186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}