{"id":55662,"date":"2022-10-03T16:43:25","date_gmt":"2022-10-03T11:13:25","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=55662"},"modified":"2022-10-03T16:43:25","modified_gmt":"2022-10-03T11:13:25","slug":"how-to-create-custom-rest-api","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/","title":{"rendered":"How to create custom Rest Api"},"content":{"rendered":"<div>\n<p>In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9.<\/p>\n<p>Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer.<\/p>\n<p><strong style=\"font-size: 1rem;\">First, <\/strong><span style=\"font-size: 1rem;\">We will need to install these core modules HTTP Basic Authentication, REST Web Services, and serialization module.<\/span><\/p>\n<\/div>\n<p>Then install Contributed module called <strong>REST UI, <\/strong>which you can download from<br \/>\nthe composer requiring &#8216;drupal\/restui:^1.21&#8217;<\/p>\n<div><\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55653\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-1024x525.png\" alt=\"Blog image\" width=\"625\" height=\"320\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-1024x525.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-300x154.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-768x393.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-624x320.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10.png 1052w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<div><\/div>\n<p>Let&#8217;s create a custom module named &#8220;<strong>Rest Example<\/strong>&#8221; in \/modules\/custom<\/p>\n<div><\/div>\n<div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-55661\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-33-46.png\" alt=\"Blog image\" width=\"236\" height=\"163\" \/><\/div>\n<\/div>\n<p>After that create <strong>ExampleRest.php <\/strong><\/p>\n<p>in directory \/modules\/custom\/rest_example\/src\/Plugin\/rest\/resource\/<strong>ExampleRest<\/strong><strong>.php<\/strong>.<\/p>\n<p>This is our custom resource file which will have get method that will get all nodes of content type Football Teams.<\/p>\n<div><\/div>\n<div><\/div>\n<div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55654\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46-1024x446.png\" alt=\"Blog image\" width=\"625\" height=\"272\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46-1024x446.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46-300x131.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46-768x335.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46-624x272.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-46-46.png 1235w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<\/div>\n<div>\n<div>\n<pre>\/**\r\n* Provides a Rest Resource Example\r\n*\r\n* @RestResource(\r\n* id = \"rest_example\",\r\n* label = @Translation(\"Rest Example Resource\"),\r\n* uri_paths = {\r\n* \"canonical\" = \"\/rest_example\"\r\n* }\r\n* )\r\n*\/<\/pre>\n<p>Let\u2019s understand annotation.<\/p>\n<\/div>\n<ul>\n<li><strong>@RestResource<\/strong> is a function, through which know, it\u2019s a kind of Rest Resource<\/li>\n<li><strong>id<\/strong>\u00a0define the id of Rest Resource API<\/li>\n<li><strong>label<\/strong>\u00a0displaying to the user through which author can know about this api<\/li>\n<li><strong>uri_paths<\/strong>\u00a0:\u00a0<strong>canonical<\/strong>\u00a0attributes set the path of API.<\/li>\n<\/ul>\n<\/div>\n<p>In our case, we will use\u00a0 &#8220;sitename<strong>\/rest_example&#8221; <\/strong>to hit our API.\u00a0After this, we need to install our module.<\/p>\n<p>Then go to <strong>\/admin\/config\/services\/rest\u00a0<\/strong>and enable our custom resource <strong>Rest Example Resource<\/strong><\/p>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55656\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1-1024x170.png\" alt=\"Blog image\" width=\"625\" height=\"104\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1-1024x170.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1-300x50.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1-768x127.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1-624x103.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-21-57-1.png 1213w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<div><\/div>\n<p>After that, select the following options<\/p>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55657\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47-1024x455.png\" alt=\"Blog image\" width=\"625\" height=\"278\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47-1024x455.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47-300x133.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47-768x341.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47-624x277.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-54-47.png 1214w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<div><\/div>\n<p>Further, allow anonymous permission to our rest resource.<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55658\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19-1024x217.png\" alt=\"Blog image\" width=\"625\" height=\"132\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19-1024x217.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19-300x64.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19-768x163.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19-624x132.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-19.png 1244w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-55659\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26-1024x227.png\" alt=\"Blog image\" width=\"625\" height=\"139\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26-1024x227.png 1024w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26-300x67.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26-768x170.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26-624x138.png 624w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-22-36-26.png 1325w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/div>\n<div><\/div>\n<div><\/div>\n<p>Now we will hit our get resource.<\/p>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-55660\" src=\"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-09-12.png\" alt=\"Blog image\" width=\"960\" height=\"637\" srcset=\"https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-09-12.png 960w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-09-12-300x199.png 300w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-09-12-768x510.png 768w, https:\/\/www.tothenew.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-30-23-09-12-624x414.png 624w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need [&hellip;]<\/p>\n","protected":false},"author":1501,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":171,"footnotes":""},"categories":[3602],"tags":[1832,4862,226],"class_list":["post-55662","post","type-post","status-publish","format-standard","hentry","category-drupal","tag-api","tag-drupal","tag-rest"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Amrit Pal Singh\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"How to create custom Rest Api | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to create custom Rest Api | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#article\",\"name\":\"How to create custom Rest Api | TO THE NEW Blog\",\"headline\":\"How to create custom Rest Api\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amrit-pal\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2022\\\/09\\\/Screenshot-from-2022-09-30-20-41-10-1024x525.png\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#articleImage\"},\"datePublished\":\"2022-10-03T16:43:25+05:30\",\"dateModified\":\"2022-10-03T16:43:25+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#webpage\"},\"articleSection\":\"Drupal, api, Drupal, REST Calls\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/drupal\\\/#listItem\",\"name\":\"Drupal\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/drupal\\\/#listItem\",\"position\":2,\"name\":\"Drupal\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/drupal\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#listItem\",\"name\":\"How to create custom Rest Api\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#listItem\",\"position\":3,\"name\":\"How to create custom Rest Api\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/drupal\\\/#listItem\",\"name\":\"Drupal\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amrit-pal\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amrit-pal\\\/\",\"name\":\"Amrit Pal Singh\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/3766577d-2e38-4413-938d-7b8dd98feed1_Amrit-Pal-Singh-Profile-Pitcure.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Amrit Pal Singh\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/\",\"name\":\"How to create custom Rest Api | TO THE NEW Blog\",\"description\":\"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-create-custom-rest-api\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amrit-pal\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/amrit-pal\\\/#author\"},\"datePublished\":\"2022-10-03T16:43:25+05:30\",\"dateModified\":\"2022-10-03T16:43:25+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to create custom Rest Api | TO THE NEW Blog","description":"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need","canonical_url":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#article","name":"How to create custom Rest Api | TO THE NEW Blog","headline":"How to create custom Rest Api","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/amrit-pal\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-ttn-blog\/uploads\/2022\/09\/Screenshot-from-2022-09-30-20-41-10-1024x525.png","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#articleImage"},"datePublished":"2022-10-03T16:43:25+05:30","dateModified":"2022-10-03T16:43:25+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#webpage"},"articleSection":"Drupal, api, Drupal, REST Calls"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/drupal\/#listItem","name":"Drupal"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/drupal\/#listItem","position":2,"name":"Drupal","item":"https:\/\/www.tothenew.com\/blog\/category\/drupal\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#listItem","name":"How to create custom Rest Api"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#listItem","position":3,"name":"How to create custom Rest Api","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/drupal\/#listItem","name":"Drupal"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/amrit-pal\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/amrit-pal\/","name":"Amrit Pal Singh","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/3766577d-2e38-4413-938d-7b8dd98feed1_Amrit-Pal-Singh-Profile-Pitcure.jpeg","width":96,"height":96,"caption":"Amrit Pal Singh"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/","name":"How to create custom Rest Api | TO THE NEW Blog","description":"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/amrit-pal\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/amrit-pal\/#author"},"datePublished":"2022-10-03T16:43:25+05:30","dateModified":"2022-10-03T16:43:25+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"How to create custom Rest Api | TO THE NEW Blog","og:description":"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need","og:url":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"How to create custom Rest Api | TO THE NEW Blog","twitter:description":"In this tutorial, we will learn how to create a custom RESTful Web Service in Drupal 9. Before creating Rest Api, we need to know what REST API is. An application programming interface (API or web API) allows interaction with RESTful web services. Where REST is known as Representational State Transfer. First, We will need","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"55662","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65e041039adac","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2022-10-03 11:07:03","updated":"2024-02-29 08:32:03","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/drupal\/\" title=\"Drupal\">Drupal<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to create custom Rest Api\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"Drupal","link":"https:\/\/www.tothenew.com\/blog\/category\/drupal\/"},{"label":"How to create custom Rest Api","link":"https:\/\/www.tothenew.com\/blog\/how-to-create-custom-rest-api\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/55662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1501"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=55662"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/55662\/revisions"}],"predecessor-version":[{"id":55665,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/55662\/revisions\/55665"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=55662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=55662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=55662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}