{"id":1786,"date":"2020-12-08T16:25:42","date_gmt":"2020-12-08T10:55:42","guid":{"rendered":"https:\/\/www.trendstechblog.com\/?p=1786"},"modified":"2020-12-08T16:26:10","modified_gmt":"2020-12-08T10:56:10","slug":"rest-api","status":"publish","type":"post","link":"https:\/\/www.trendstechblog.com\/rest-api\/","title":{"rendered":"How To Work The REST API"},"content":{"rendered":"<p>The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications written in equally heterogeneous languages. The whole must be able to communicate and offer services such as those we know (<span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.trendstechblog.com\/search-engine-optimization-trends-in-2020\/\"><strong>search engines<\/strong><\/a><\/span>, multimedia platforms). But what is the place of the REST API?<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_58 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-655ded72cce63\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-655ded72cce63\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.trendstechblog.com\/rest-api\/#The_Rules_Of_Communication\" title=\"The Rules Of Communication\">The Rules Of Communication<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.trendstechblog.com\/rest-api\/#REST_API\" title=\"REST API\">REST API<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.trendstechblog.com\/rest-api\/#REST_Constraints\" title=\"REST Constraints\">REST Constraints<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.trendstechblog.com\/rest-api\/#A_Robust_Light_And_Efficient_Interface\" title=\"A Robust, Light And Efficient Interface\">A Robust, Light And Efficient Interface<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"The_Rules_Of_Communication\"><\/span>The Rules Of Communication<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>An API, Application Program Interface, is, as its name suggests, a system of rules between applications, which allows them to communicate with each other. In the client-server framework, when you, the client, call up service, on a server, you send your request in such a way that the service provider understands the proposal. The answer, too, must be shaped so that you can understand it.<\/p>\n<p>For example, during a search on the web, you make a dedicated search engine query. According to the criteria of the latter (title, type of resource (text, image)), the engine returns a response. Your browser interprets this to display the result in the expected form. This is the role of an API.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"REST_API\"><\/span>REST API<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer\"><strong>REST API<\/strong><\/a><\/span>, Representational State Transfer, sometimes referred to as RESTful, is an API that enables the communication between two web applications in a lightweight and efficient manner.<\/p>\n<p>It was defined by Roy Fielding, a significant contributor to the HTTP protocol, in his doctoral thesis on styles of software architecture. The REST API is based on the HTTP protocol. It makes particular use of the GET, POST and PUT methods. The exchange format between the client and the server is not defined, it can just as quickly be JSON, XML, as plain text. It&#8217;s a perfect API for a headless content management system like Strapi.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"REST_Constraints\"><\/span>REST Constraints<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The REST API does not describe any implementation, just a set of rules. An application is considered RESTful if it respects six constraints established by Roy Fielding:<\/p>\n<ul>\n<li>Communication takes place between two applications with different roles: a client and a server.<\/li>\n<li>The requests sent by the client are independent of each other. Each of them contains all the information necessary for the processing of the claim by the server.<\/li>\n<li>Responses must explicitly allow or not their caching. This avoids the use of obsolete data, and makes it possible to optimize communication in the case of &#8220;cacheable&#8221; data.<\/li>\n<li>The communication interface must be uniform, i.e. respect a certain number of rules:<\/li>\n<li>Identifiable resources (URI).<\/li>\n<li>Resources that can be handled by the server.<\/li>\n<li>Self-describing messages, the content is sufficient for the server to respond to the request.<\/li>\n<li>Hypermedia as the Engine of Application State.<\/li>\n<li>Submissions must be able to be encapsulated. A server can thus call on another server to respond to a claim in a completely transparent way.<\/li>\n<li>The server must be able to send executable code, such as Java Scripts or JAVA applets, to the client to add temporary functionality to it.<\/li>\n<\/ul>\n<p>Few implementations respect the six rules. To define a level of compliance, it is possible to refer to the Richardson maturity model. Composed of 4 levels, from 0 to 3, based on four criteria:<\/p>\n<ul>\n<li>Resource Identification (URI).<\/li>\n<li>HTTP implementation level (GET, POST, etc.).<\/li>\n<li>HTTP return codes.<\/li>\n<li>HATEOAS.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"A_Robust_Light_And_Efficient_Interface\"><\/span>A Robust, Light And Efficient Interface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The REST API is a set of rules that allows interoperability between a client and a server. It is based on the robust HTTP protocol, exchanging data, in most cases, in JSON format, which is both efficient and easily readable by humans. An apparent interest is the <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.trendstechblog.com\/client-server-model\/\"><strong>client-server<\/strong><\/a><\/span> decoupling.<\/p>\n<p><span style=\"color: #0000ff;\"><strong>Also Read: <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.trendstechblog.com\/the-implied-meaning-of-watches\/\">The Implied Meaning Of Watches<\/a><\/span><\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications written in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1787,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[392,405,404,248,329],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Work The REST API From Trends Tech Blog<\/title>\n<meta name=\"description\" content=\"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.\" \/>\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.trendstechblog.com\/rest-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Work The REST API From Trends Tech Blog\" \/>\n<meta property=\"og:description\" content=\"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.trendstechblog.com\/rest-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Trends Tech Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-08T10:55:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-08T10:56:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/12\/How-To-Work-The-REST-API.Jpg.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TrendsTechBlog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@trendstechblog\" \/>\n<meta name=\"twitter:site\" content=\"@trendstechblog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TrendsTechBlog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/\"},\"author\":{\"name\":\"TrendsTechBlog\",\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1\"},\"headline\":\"How To Work The REST API\",\"datePublished\":\"2020-12-08T10:55:42+00:00\",\"dateModified\":\"2020-12-08T10:56:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/\"},\"wordCount\":586,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1\"},\"keywords\":[\"API\",\"Client Server\",\"Rest API\",\"Software\",\"Technology\"],\"articleSection\":[\"TECHNOLOGY\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.trendstechblog.com\/rest-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/\",\"url\":\"https:\/\/www.trendstechblog.com\/rest-api\/\",\"name\":\"How To Work The REST API From Trends Tech Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.trendstechblog.com\/#website\"},\"datePublished\":\"2020-12-08T10:55:42+00:00\",\"dateModified\":\"2020-12-08T10:56:10+00:00\",\"description\":\"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.trendstechblog.com\/rest-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.trendstechblog.com\/rest-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.trendstechblog.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TECHNOLOGY\",\"item\":\"https:\/\/www.trendstechblog.com\/category\/technology\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Work The REST API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.trendstechblog.com\/#website\",\"url\":\"https:\/\/www.trendstechblog.com\/\",\"name\":\"Trends Tech Blog\",\"description\":\"Daily Tech Updates\",\"publisher\":{\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.trendstechblog.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1\",\"name\":\"TrendsTechBlog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/06\/Trends-Tech-Blog-Logo.png\",\"contentUrl\":\"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/06\/Trends-Tech-Blog-Logo.png\",\"width\":280,\"height\":70,\"caption\":\"TrendsTechBlog\"},\"logo\":{\"@id\":\"https:\/\/www.trendstechblog.com\/#\/schema\/person\/image\/\"},\"description\":\"TrendsTechBlog it's a Technologies Related that gives the Technology News, Business, Gadgest, Digital, Mobiles, Social Media, AI. Latest Trends and Up coming News.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Work The REST API From Trends Tech Blog","description":"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.","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.trendstechblog.com\/rest-api\/","og_locale":"en_US","og_type":"article","og_title":"How To Work The REST API From Trends Tech Blog","og_description":"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.","og_url":"https:\/\/www.trendstechblog.com\/rest-api\/","og_site_name":"Trends Tech Blog","article_published_time":"2020-12-08T10:55:42+00:00","article_modified_time":"2020-12-08T10:56:10+00:00","og_image":[{"width":1280,"height":675,"url":"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/12\/How-To-Work-The-REST-API.Jpg.jpg","type":"image\/jpeg"}],"author":"TrendsTechBlog","twitter_card":"summary_large_image","twitter_creator":"@trendstechblog","twitter_site":"@trendstechblog","twitter_misc":{"Written by":"TrendsTechBlog","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.trendstechblog.com\/rest-api\/#article","isPartOf":{"@id":"https:\/\/www.trendstechblog.com\/rest-api\/"},"author":{"name":"TrendsTechBlog","@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1"},"headline":"How To Work The REST API","datePublished":"2020-12-08T10:55:42+00:00","dateModified":"2020-12-08T10:56:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.trendstechblog.com\/rest-api\/"},"wordCount":586,"commentCount":0,"publisher":{"@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1"},"keywords":["API","Client Server","Rest API","Software","Technology"],"articleSection":["TECHNOLOGY"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.trendstechblog.com\/rest-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.trendstechblog.com\/rest-api\/","url":"https:\/\/www.trendstechblog.com\/rest-api\/","name":"How To Work The REST API From Trends Tech Blog","isPartOf":{"@id":"https:\/\/www.trendstechblog.com\/#website"},"datePublished":"2020-12-08T10:55:42+00:00","dateModified":"2020-12-08T10:56:10+00:00","description":"The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications.","breadcrumb":{"@id":"https:\/\/www.trendstechblog.com\/rest-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.trendstechblog.com\/rest-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.trendstechblog.com\/rest-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.trendstechblog.com\/"},{"@type":"ListItem","position":2,"name":"TECHNOLOGY","item":"https:\/\/www.trendstechblog.com\/category\/technology\/"},{"@type":"ListItem","position":3,"name":"How To Work The REST API"}]},{"@type":"WebSite","@id":"https:\/\/www.trendstechblog.com\/#website","url":"https:\/\/www.trendstechblog.com\/","name":"Trends Tech Blog","description":"Daily Tech Updates","publisher":{"@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.trendstechblog.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/323aae267386ddba7224403d86f419d1","name":"TrendsTechBlog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/image\/","url":"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/06\/Trends-Tech-Blog-Logo.png","contentUrl":"https:\/\/www.trendstechblog.com\/wp-content\/uploads\/2020\/06\/Trends-Tech-Blog-Logo.png","width":280,"height":70,"caption":"TrendsTechBlog"},"logo":{"@id":"https:\/\/www.trendstechblog.com\/#\/schema\/person\/image\/"},"description":"TrendsTechBlog it's a Technologies Related that gives the Technology News, Business, Gadgest, Digital, Mobiles, Social Media, AI. Latest Trends and Up coming News."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/posts\/1786"}],"collection":[{"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/comments?post=1786"}],"version-history":[{"count":1,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/posts\/1786\/revisions"}],"predecessor-version":[{"id":1788,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/posts\/1786\/revisions\/1788"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/media\/1787"}],"wp:attachment":[{"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/media?parent=1786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/categories?post=1786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trendstechblog.com\/wp-json\/wp\/v2\/tags?post=1786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}