{"id":22174,"date":"2020-10-18T15:16:36","date_gmt":"2020-10-18T09:46:36","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/"},"modified":"2024-10-15T01:02:34","modified_gmt":"2024-10-14T19:32:34","slug":"what-is-rest-api-in-python","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/","title":{"rendered":"What is Rest API in Python? How to create web APIs with Python?"},"content":{"rendered":"\n<p><strong><em>Contributed by: <a href=\"https:\/\/www.linkedin.com\/in\/akash-mishra-667585a3\/\" target=\"_blank\" rel=\"nofollow noreferrer noopener\" aria-label=\"Akash Mishra  (opens in a new tab)\">Akash Mishra <\/a><\/em><\/strong><\/p>\n\n\n\n<p>Rest (Representational State Transfer) API Python framework is a set of utilities based on werkzeug to easily build Restful API. It is easy to configure and extends with ease. It does not decide how the data can be rendered, nor any other decision. Instead, it\u2019s an easily extensible architecture to build one\u2019s API.<\/p>\n\n\n\n<p>Python REST API Framework has not been created for the usual case but hooks on to special resource providers with special view management, and special way of displaying data. Python REST API is fully rest compliant with the implementation as below.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GET<\/li>\n\n\n\n<li>POST<\/li>\n\n\n\n<li>UPDATE<\/li>\n\n\n\n<li>DELETE<\/li>\n\n\n\n<li>HEAD<\/li>\n<\/ul>\n\n\n\n<p>Along with implementation of below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PAGINATION<\/li>\n\n\n\n<li>AUTHENTICATION<\/li>\n\n\n\n<li>RATE-LIMIT<\/li>\n\n\n\n<li>DATA VALIDATION<\/li>\n\n\n\n<li>PARTIAL RESPONSE<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"architecture\"><strong>Architecture<\/strong><\/h4>\n\n\n\n<p>Python REST API Framework is based on the MVC pattern where we define some endpoints explaining a Resource, a Controller and a View which are configurable. Learn more with the help of <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/python-project-ideas\" target=\"_blank\" rel=\"noreferrer noopener\">python project ideas<\/a> and also get a <a href=\"https:\/\/www.mygreatlearning.com\/api\/free-courses\" target=\"_blank\" rel=\"noreferrer noopener\">API certificates<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"controller\"><strong>Controller<\/strong><\/h4>\n\n\n\n<p>It manages the way a request is handled. It creates URL endpoints and also, List, Unique and Auto-documented endpoints. It manages pagination, formators, authentication, authorization, rate-limit and allowed method.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"data-store\"><strong>Data Store<\/strong><\/h4>\n\n\n\n<p>Each method of a Controller, calls the Data Store to interact with the data. Data Store is used to retrieve data from the resource. Each data store acts on a particular type of resource (database backend, API backend, CSV backend etc.) which validates data, creates new resources, updates existing resources, manages filters and pagination.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"view\"><strong>View<\/strong><\/h4>\n\n\n\n<p>It defines how the data must be sent to the client. It passes a Response object and sets the needed headers, mime-type and other presentation options like formators.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-title-link\">Python Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">In this course, you will learn the fundamentals of Python: from basic syntax to mastering data structures, loops, and functions. You will also explore OOP concepts and objects to build robust programs.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>11.5 Hrs<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>51 Coding Exercises<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-button\">\n                Start Free Trial\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-use-rest-api-in-python\"><strong>How To use Rest API in Python<\/strong><\/h2>\n\n\n\n<p>Rest API can be used by creating as many endpoints and for each endpoint defining a resource, a controller and a view. These are then added to the&nbsp;<strong>rest_api_framework.controllers.WSGIDispatcher<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"a-sample-api\"><strong>A Sample API<\/strong><\/h4>\n\n\n\n<p>For this sample, we will use a python list.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nresources = &#x5B;\n    {&quot;name&quot;: &quot;Akash&quot;,\n    &quot;age&quot;: a,\n    &quot;id&quot;: a\n    } for a in range(100)\n    ]\n\n<\/pre><\/div>\n\n\n<p>Then we describe this resource by creating a Model class inheriting from base Model class:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom rest_api_framework import models\nclass ApiModel(models.Model):\n    fields = &#x5B;models.IntegerField(name=&quot;age&quot;, required=True),\n              models.StringField(name=&quot;name&quot;, required=True),\n              models.PkField(name=&quot;id&quot;)\n              ]\n\n<\/pre><\/div>\n\n\n<p>There are validators for each field so that when these are reused, we get free validators.<\/p>\n\n\n\n<p>There is already an existing datastore to handle it: PythonListDataStore.<\/p>\n\n\n\n<p>We can reuse this store: from rest_api_framework.datastore import PythonListDataStore<\/p>\n\n\n\n<p>Then Controller class is called to handle API: from rest_api_framework.controllers import Controller and a view to render our data: from rest_api_framework.views import JsonResponse<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nclass ApiApp(Controller):\n    resource = {\n        &quot;resource_name&quot;: &quot;address&quot;,\n        &quot;resource&quot;: resources,\n        &quot;model&quot;: ApiModel,\n        &quot;datastore&quot;: PythonListDataStore\n        }\n    controller = {\n        &quot;list_verbs&quot;: &#x5B;&quot;GET&quot;, &quot;POST&quot;],\n        &quot;unique_verbs&quot;: &#x5B;&quot;GET&quot;, &quot;PUT&quot;, &quot;DELETE&quot;],\n        }\n    view = {&quot;response_class&quot;: JsonResponse}\nA controller is build with 3 dicts:\n\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"resource\"><strong>Resource<\/strong><\/h4>\n\n\n\n<p>Resources define your data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>resource_name:<\/strong> This argument is used to build the URL endpoint<\/li>\n\n\n\n<li><strong>resource: <\/strong>This argument guides datastore as to how they can be accessed. It can be the database name and the database table for a SQL datastore or the URL endpoint to a distant API<\/li>\n\n\n\n<li><strong>model: <\/strong>This argument describes the visual of the data i.e. which field to show, how to validate and so on.<\/li>\n\n\n\n<li><strong>datastore: <\/strong>This argument gives the type of data.<strong> <\/strong>There is a datastore for a simple Python list of dict and SQLite datastore.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"controller\"><strong>Controller<\/strong><\/h4>\n\n\n\n<p>The controller defines how data should be accessed.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>list_verbs: <\/strong>This argument defines the verbs that can be used on the main end point of your resource. If \u201cPOST\u201d is not used, a user cannot create new resources on the datastore.<\/li>\n\n\n\n<li><strong>unique_verbs: <\/strong>&nbsp;This argument defines the verbs that can be used on the unique identifier of the resource. Actions depending on the verbs follows the REST implementation: PUT to modify an existing resource, DELETE to delete a resource.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"view\"><strong>View<\/strong><\/h4>\n\n\n\n<p>View is defined to render the resources to the user through either Json format, XML, or any other. It can also render pagination tokens, first page, last page, number of objects and other useful information for users.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>response_class: this is used to render data.<\/li>\n<\/ul>\n\n\n\n<p>To test the application locally, we need to add: if __name__ == '__main__': from werkzeug.serving import run_simple<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n  from rest_api_framework.controllers import WSGIDispatcher\n    app = WSGIDispatcher(&#x5B;ApiApp])\n    run_simple(&#039;127.0.0.1&#039;, 5000, app, use_debugger=True, use_reloader=True)\n\n<\/pre><\/div>\n\n\n<p>then type \u201cpython app.py\u201d and your API is up and running.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"options\"><strong>Options<\/strong><\/h4>\n\n\n\n<p>Each of these dicts can take an optional parameter: \u201coption\u201d. This parameter contains the options to use with either the datastore, the view or the controller.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"using-database\"><strong>Using Database<\/strong><\/h2>\n\n\n\n<p>We can save the data in a database. To do so, we need to change the datastore and define your resources in SQL datastore.<\/p>\n\n\n\n<p>SQLiteDataStore uses sqlite3 as a database backend. \u2018resources\u2019 will be dict with database name and table name. The rest remains the same as with PythonListDataStore.<\/p>\n\n\n\n<p>REST API framework creates the database for us, if the sqlite3 database does not exist.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom rest_api_framework.datastore import SQLiteDataStore\nfrom rest_api_framework.controllers import Controller\nfrom rest_api_framework.views import JsonResponse\nfrom rest_api_framework import models\nfrom rest_api_framework.pagination import Pagination\n \nclass ApiModel(models.Model):\n    fields = &#x5B;models.StringField(name=&quot;message&quot;, required=True),\n              models.StringField(name=&quot;user&quot;, required=True),\n              models.PkField(name=&quot;id&quot;, required=True),\n              ]\n \nclass ApiApp(Controller):\n    resource = {\n       &quot;ressource_name&quot;: &quot;tweets&quot;,\n       &quot;ressource&quot;: {&quot;name&quot;: &quot;twitter.db&quot;, &quot;table&quot;: &quot;tweets&quot;},\n       &quot;datastore&quot;: SQLiteDataStore,\n       &quot;model&quot;: ApiModel\n    }\n    controller = {\n       &quot;list_verbs&quot;: &#x5B;&quot;GET&quot;, &quot;POST&quot;],\n       &quot;unique_verbs&quot;: &#x5B;&quot;GET&quot;, &quot;PUT&quot;, &quot;DELETE&quot;]\n       &quot;options&quot;: {&quot;pagination&quot;: Pagination(20)}\n    }\n    view = {&quot;response_class&quot;: JsonResponse}\n \nif __name__ == &#039;__main__&#039;:\n    from werkzeug.serving import run_simple\n    from rest_api_framework.controllers import WSGIDispatcher\n    app = WSGIDispatcher(&#x5B;ApiApp])\n    run_simple(&#039;127.0.0.1&#039;, 5000, app, use_debugger=True, use_reloader=True\n\n<\/pre><\/div>\n\n\n<p>This brings us to the end of the blog on Rest API Python. We hope you enjoyed this and are able to understand the concept more clearly. If you want to learn more such concepts, you can enrol with <a aria-label=\"Great Learning Academy's free online courses (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/academy\" target=\"_blank\" rel=\"noreferrer noopener\">Great Learning Academy's free online courses<\/a> and unlock your dream career. <\/p>\n\n\n\n<p>Embarking on a journey towards a career in data science opens up a world of limitless possibilities. Whether you\u2019re an aspiring data scientist or someone intrigued by the power of data, understanding the key factors that contribute to success in this field is crucial. The below path will guide you to become a proficient data scientist.<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table class=\"has-cyan-bluish-gray-background-color has-background\"><tbody><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/certificates\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Certificates<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/placements\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Placements<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/syllabus\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Syllabus<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/eligibility\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Eligibility<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Contributed by: Akash Mishra Rest (Representational State Transfer) API Python framework is a set of utilities based on werkzeug to easily build Restful API. It is easy to configure and extends with ease. It does not decide how the data can be rendered, nor any other decision. Instead, it\u2019s an easily extensible architecture to build [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":22177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[36796],"content_type":[],"class_list":["post-22174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-python"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>What is Rest API in Python | How to create APIs in Python?<\/title>\n<meta name=\"description\" content=\"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Rest API in Python? How to create web APIs with Python?\" \/>\n<meta property=\"og:description\" content=\"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-18T09:46:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-14T19:32:34+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1289\" \/>\n\t<meta property=\"og:image:height\" content=\"814\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"What is Rest API in Python? How to create web APIs with Python?\",\"datePublished\":\"2020-10-18T09:46:36+00:00\",\"dateModified\":\"2024-10-14T19:32:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/\"},\"wordCount\":895,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/iStock-1215417094.jpg\",\"keywords\":[\"python\"],\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/\",\"name\":\"What is Rest API in Python | How to create APIs in Python?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/iStock-1215417094.jpg\",\"datePublished\":\"2020-10-18T09:46:36+00:00\",\"dateModified\":\"2024-10-14T19:32:34+00:00\",\"description\":\"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/iStock-1215417094.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/iStock-1215417094.jpg\",\"width\":1289,\"height\":814,\"caption\":\"rest api python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/what-is-rest-api-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What is Rest API in Python? How to create web APIs with Python?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What is Rest API in Python | How to create APIs in Python?","description":"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/","og_locale":"en_US","og_type":"article","og_title":"What is Rest API in Python? How to create web APIs with Python?","og_description":"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2020-10-18T09:46:36+00:00","article_modified_time":"2024-10-14T19:32:34+00:00","og_image":[{"width":1289,"height":814,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"What is Rest API in Python? How to create web APIs with Python?","datePublished":"2020-10-18T09:46:36+00:00","dateModified":"2024-10-14T19:32:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/"},"wordCount":895,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg","keywords":["python"],"articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/","url":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/","name":"What is Rest API in Python | How to create APIs in Python?","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg","datePublished":"2020-10-18T09:46:36+00:00","dateModified":"2024-10-14T19:32:34+00:00","description":"How to create APIs in Python: Rest API Python (Representational State Transfer) framework is a set of utilities based on werkzeug to easily build Restful API.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg","width":1289,"height":814,"caption":"rest api python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/what-is-rest-api-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"What is Rest API in Python? How to create web APIs with Python?"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",1289,814,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094-300x189.jpg",300,189,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094-768x485.jpg",768,485,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094-1024x647.jpg",1024,647,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",1289,814,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",1289,814,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",640,404,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",96,61,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/10\/iStock-1215417094.jpg",150,95,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Contributed by: Akash Mishra Rest (Representational State Transfer) API Python framework is a set of utilities based on werkzeug to easily build Restful API. It is easy to configure and extends with ease. It does not decide how the data can be rendered, nor any other decision. Instead, it\u2019s an easily extensible architecture to build&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/22174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=22174"}],"version-history":[{"count":11,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/22174\/revisions"}],"predecessor-version":[{"id":108408,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/22174\/revisions\/108408"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/22177"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=22174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=22174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=22174"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=22174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}