{"id":1314,"date":"2021-04-30T23:06:30","date_gmt":"2021-04-30T17:36:30","guid":{"rendered":"https:\/\/www.rockerstop.com\/blog\/?p=1314"},"modified":"2021-04-30T23:06:32","modified_gmt":"2021-04-30T17:36:32","slug":"how-does-the-restful-api-work","status":"publish","type":"post","link":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/","title":{"rendered":"What Is A RESTful API?"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><strong>How does the RESTful API work?<\/strong><\/h1>\n\n\n\n<p>What is RESTful Api? How to create a REST API? How a REST API really works? We will discuss all these things in this blog.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is an API?<\/h2>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-5.png\" alt=\"RESTful API\" class=\"wp-image-1315\" width=\"697\" height=\"392\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-5.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-5-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>API stands for Application Program interface and that\u2019s a very broad term. There are all kinds of api\u2019s but we are going to talk about Web api\u2019s. There is an API senior computer operating system in your smartphone and even in some refrigerators and so on. This is very generalized but it\u2019s essentially a contract provided by one piece of software to another piece of software.\u00a0\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Analogy<\/h2>\n\n\n\n<p>It usually consists of a structured request and then a structured response one piece of software says give me this information formatted in this way. To understand we\u2019re going to take a look at a couple analogies.&nbsp;<br><\/p>\n\n\n\n<p>Think of yourself at sitting at a table at a restaurant in your one piece of software such as a web application on the client side and then in the kitchen is the server or the assistance that processes certain requests then the waiter is like an API is formatted to take a certain order in a particular way and then bring back a specific meal this will be the information, data or the response that you requested so an API is typically a messenger or a waiter between running software.&nbsp;<br><\/p>\n\n\n\n<p>Another analogy is box here this toy so if we think of this as an API it\u2019s formatted to take certain shapes so the client has to format the request as a circle, square or triangle anything else will be taken you\u2019ll get some sorts of error message or error response so this is way how an API works and you can think of these shapes as the API standard whether it\u2019s Jason or soap or something else so to make this operate even more like a real API we could have some kind of output once the formatted shape requests go in that would be your response.&nbsp;<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is REST?<\/h2>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-7.png\" alt=\"RESTful API\" class=\"wp-image-1316\" width=\"699\" height=\"393\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-7.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-7-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>REST stands for representational state transfer; it&#8217;s an architecture style for designing network applications. It works depending on a stateless client-server communication protocol and in most of the cases this is going to be HTTP. HTTP is basically the foundation of the communication of the internet of the web.&nbsp;<br><\/p>\n\n\n\n<p>Every time you load a web page in your browser it\u2019s making an HTTP request to a server somewhere. It is possible to use other protocols with rest but HTTP is by far the most used because in order to use real- world rest you need the delivery methods that HTTP offers rest to treat objects on the server side as resources that can be created, updated and destroyed or deleted an example of a server-side object would blog post in a database or something like that.&nbsp;<br><\/p>\n\n\n\n<p>We can create these posts with a post request, a delete with a delete request and so on. What makes REST so awesome is that it operates using just HTTP and usually some kind of standard like Jason so it can be used by virtually any programming language because most of the good languages can make HTTP requests in some way whether it\u2019s PHP JavaScript rails Java Python all of these languages are perfectly capable of working with Rexel interfaces.&nbsp;<br><\/p>\n\n\n\n<p>So, API is the messenger and rest let us use HTTP requests to format those messages. You may also hear the term RESTful api and that just refers to conforming to the rest constraints so rest api and RESTful api are essentially the same thing.&nbsp;<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">HTTP Methods<\/h2>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-6.png\" alt=\"RESTful API\" class=\"wp-image-1317\" width=\"691\" height=\"389\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-6.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-6-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>Now we have established what a rest api is. Let&#8217;s look at the specific methods and requests that can be made to a server through HTTP.<br><\/p>\n\n\n\n<p>GET request is the most common way your browser client makes requests every day just by going to a specific server URI and requests are used to do just that; they get data or retrieve data from a particular resource.&nbsp;<br><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-2.png\" alt=\"RESTful API\" class=\"wp-image-1318\" width=\"687\" height=\"387\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-2.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-2-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>POST requests, you probably use these everyday as well because every time you fill out a webform you\u2019re making a post request in most cases you can also make requests from forms but its not secure and the data you submit can be seen by anyone. Form tags in HTML can take an action and a method attribute so the action would be the page that you\u2019re submitting to and then the method would be either post or get.&nbsp;<br><\/p>\n\n\n\n<p>These are only the two requests that can be made from just a web form on its own.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication\u00a0<\/h2>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-4.png\" alt=\"RESTful API\" class=\"wp-image-1320\" width=\"684\" height=\"385\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-4.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-4-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>Authenticate can mean just register registering your app with the providers website. Even sometimes you\u2019ll have to pay for it you\u2019ll have to purchase that data access so there\u2019s a few ways that authentication is implemented. So usually you\u2019ll use OAuth which involves getting some kind of access token and sending that along with your request so if you tend to attempt to make a request without that then you\u2019ll get some kind of unauthorized ever. <a href=\"https:\/\/docs.github.com\/en\/rest\">GitHub has all the information about REST API.<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-3.png\" alt=\"RESTful API\" class=\"wp-image-1321\" width=\"666\" height=\"375\" srcset=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-3.png 574w, https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-3-300x169.png 300w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p><br><\/p>\n\n\n\n<p>Postman is to run the api, you can download it in your system. Put your endpoint and then the type of request in some cases you\u2019ll have to send data or maybe some header values for instance if you need to do authorization you can put the value. If you need to send data you can do that as well. If it is a post request you can send the body in different forms like raw data or Jason.&nbsp;&nbsp;<br><\/p>\n\n\n\n<p>This was all about what is REST API. Now hopefully you have a better idea on How RESTful API works.&nbsp;<br><\/p>\n\n\n\n<p><a href=\"https:\/\/www.rockerstop.com\/blog\/\">Stay updated on our blog<\/a> for more useful information. <br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How does the RESTful API work? What is RESTful Api? How to create a REST API? How a REST API really works? We will discuss all these things in this blog. What is an API? API stands for Application Program interface and that\u2019s a very broad term. There are all kinds of api\u2019s but we &hellip; <a href=\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;What Is A RESTful API?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":1322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[90],"tags":[241,239,240],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.10 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How does the RESTful API work? | Rockerstop Blog<\/title>\n<meta name=\"description\" content=\"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API&#039;s\" \/>\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.rockerstop.com\/blog\/how-does-the-restful-api-work\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How does the RESTful API work? | Rockerstop Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API&#039;s\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/\" \/>\n<meta property=\"og:site_name\" content=\"Rockerstop\u00ae Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-30T17:36:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-30T17:36:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"574\" \/>\n\t<meta property=\"og:image:height\" content=\"323\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"deepshikha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"deepshikha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/\",\"url\":\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/\",\"name\":\"How does the RESTful API work? | Rockerstop Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.rockerstop.com\/blog\/#website\"},\"datePublished\":\"2021-04-30T17:36:30+00:00\",\"dateModified\":\"2021-04-30T17:36:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/b329b53739a3a5ed5d2ac913e473b4a3\"},\"description\":\"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API's\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rockerstop.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What Is A RESTful API?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rockerstop.com\/blog\/#website\",\"url\":\"https:\/\/www.rockerstop.com\/blog\/\",\"name\":\"Rockerstop\u00ae Blog\",\"description\":\"Find High Quality Articles &amp; Blogs\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rockerstop.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/b329b53739a3a5ed5d2ac913e473b4a3\",\"name\":\"deepshikha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/46ae8cb05b9e8120823c2a4497b10b42?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/46ae8cb05b9e8120823c2a4497b10b42?s=96&d=mm&r=g\",\"caption\":\"deepshikha\"},\"url\":\"https:\/\/www.rockerstop.com\/blog\/author\/deepshikha\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How does the RESTful API work? | Rockerstop Blog","description":"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API's","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.rockerstop.com\/blog\/how-does-the-restful-api-work\/","og_locale":"en_US","og_type":"article","og_title":"How does the RESTful API work? | Rockerstop Blog","og_description":"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API's","og_url":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/","og_site_name":"Rockerstop\u00ae Blog","article_published_time":"2021-04-30T17:36:30+00:00","article_modified_time":"2021-04-30T17:36:32+00:00","og_image":[{"width":574,"height":323,"url":"https:\/\/www.rockerstop.com\/blog\/wp-content\/uploads\/2021\/04\/RESTful-API-1.png","type":"image\/png"}],"author":"deepshikha","twitter_card":"summary_large_image","twitter_misc":{"Written by":"deepshikha","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/","url":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/","name":"How does the RESTful API work? | Rockerstop Blog","isPartOf":{"@id":"https:\/\/www.rockerstop.com\/blog\/#website"},"datePublished":"2021-04-30T17:36:30+00:00","dateModified":"2021-04-30T17:36:32+00:00","author":{"@id":"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/b329b53739a3a5ed5d2ac913e473b4a3"},"description":"In this blog you will get idea about about is RESTful Api? How does RESTful API works? What are the HTTP method used in REST API's","breadcrumb":{"@id":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.rockerstop.com\/blog\/how-does-the-restful-api-work\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rockerstop.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What Is A RESTful API?"}]},{"@type":"WebSite","@id":"https:\/\/www.rockerstop.com\/blog\/#website","url":"https:\/\/www.rockerstop.com\/blog\/","name":"Rockerstop\u00ae Blog","description":"Find High Quality Articles &amp; Blogs","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rockerstop.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/b329b53739a3a5ed5d2ac913e473b4a3","name":"deepshikha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rockerstop.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/46ae8cb05b9e8120823c2a4497b10b42?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/46ae8cb05b9e8120823c2a4497b10b42?s=96&d=mm&r=g","caption":"deepshikha"},"url":"https:\/\/www.rockerstop.com\/blog\/author\/deepshikha\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/posts\/1314"}],"collection":[{"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/comments?post=1314"}],"version-history":[{"count":1,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/posts\/1314\/revisions"}],"predecessor-version":[{"id":1323,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/posts\/1314\/revisions\/1323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/media\/1322"}],"wp:attachment":[{"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/media?parent=1314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/categories?post=1314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rockerstop.com\/blog\/wp-json\/wp\/v2\/tags?post=1314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}