{"id":102130,"date":"2021-05-10T11:00:00","date_gmt":"2021-05-10T08:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=102130"},"modified":"2021-05-04T13:16:50","modified_gmt":"2021-05-04T10:16:50","slug":"introduction-to-python-rest-api","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/","title":{"rendered":"Introduction to Python REST API"},"content":{"rendered":"<p>Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.<\/p>\n<ul>\n<li><strong>Flask<\/strong> is a micro-framework as it does not require any particular tools or libraries. It has no database layer, form validations, or any other third-party library that provides common functions<\/li>\n<li><strong>Connexion<\/strong> is a framework on top of the Flask micro-framework that automatically handles the HTTP endpoints defined using <a href=\"https:\/\/www.openapis.org\/\" target=\"_blank\" rel=\"noopener\">OpenAPI<\/a> specification (formally known as the Swagger)<\/li>\n<\/ul>\n<h2>1. Introduction<\/h2>\n<p><strong>REST<\/strong> stands for Representational state transfer and it fits in the HTTP protocol designed worldwide for the users. RESTful is \u2013<\/p>\n<ul>\n<li>Uniform interface for client-server communication<\/li>\n<li>Stateless in nature meaning each request coming from the client should contain all the information required by the server in order to process the incoming request<\/li>\n<li>Cacheable in nature<\/li>\n<li>Support the HATEOAS principle in order to drive the links from the server-side rather than client hardcoding it<\/li>\n<li>RESTful web services provide different HTTP request methods. Out of all these, the most common ones are \u2013\n<ul>\n<li>GET \u2013 Obtaining information about the entity<\/li>\n<li>POST \u2013 Creating a new entity<\/li>\n<li>PUT \u2013 Updating the existing entity (if found) or creating a new one<\/li>\n<li>DELETE \u2013 Deleting an entity<\/li>\n<\/ul>\n<\/li>\n<li>Does not restrict user for a specific format of the request. However in general the request is provided in the JSON format<\/li>\n<\/ul>\n<p>To start with this tutorial we will need to install Python and set up some of the third-party Python libraries. Let us go ahead and install them one by one.<\/p>\n<h3>1.1 Setting up Python<\/h3>\n<p>If someone needs to go through the Python installation on Windows, please watch <a href=\"https:\/\/www.youtube.com\/watch?v=i-MuSAwgwCU\" target=\"_blank\" rel=\"noopener\">this<\/a> link. You can download the Python from <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener\">this<\/a> link.<\/p>\n<h3>1.2 Setting up Flask<\/h3>\n<p>Once the python is successfully installed on your system you can install the <strong>Flask<\/strong> using a simple <code>pip<\/code> command. You can fire the below command from the command prompt and it will successfully download the module from <a href=\"https:\/\/pypi.org\/project\/Flask\/\" target=\"_blank\" rel=\"noopener\">pypi.org<\/a> and install it.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Installation command<\/em><\/span><\/p>\n<pre class=\"brush:python;\">pip install -U Flask\n<\/pre>\n<h3>1.3 Setting up Connexion &amp; Connexion Swagger<\/h3>\n<p>Once the python is successfully installed on your system you can install the <strong>connexion<\/strong> and <strong>connexion-swagger<\/strong> modules using a simple <code>pip<\/code> command. You can fire the below commands from the command prompt and it will successfully download the modules from pypi.org and install it.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Installation commands<\/em><\/span><\/p>\n<pre class=\"brush:python;\">pip install -U connexion\n\npip install -U connexion[swagger-ui]\n<\/pre>\n<h2>2. Introduction to Python REST API<\/h2>\n<p>Before going any deeper into the practice I am assuming that you are aware of the Python and OpenAPI basics. Let us dive in with the programming stuff now.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-project-structure-guide-img1.jpg\"><img decoding=\"async\" width=\"598\" height=\"127\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-project-structure-guide-img1.jpg\" alt=\"Python REST api - project structure\" class=\"wp-image-102131\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-project-structure-guide-img1.jpg 598w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-project-structure-guide-img1-300x64.jpg 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><figcaption>Fig. 1: Project structure<\/figcaption><\/figure>\n<\/div>\n<h3><a name=\"swagger-config-file\"><\/a>2.1 Creating an OpenAPI configuration<\/h3>\n<p>Add the following code to the <a href=\"https:\/\/support.smartbear.com\/swaggerhub\/docs\/tutorials\/openapi-3-tutorial.html\" target=\"_blank\" rel=\"noopener\">OpenAPI\/Swagger configuration file<\/a> which will contain all the necessary information to define the application endpoints. The YML configuration file is written in a hierarchical manner where the indentation level represents the level of scope and ownership. The file consists of the following information \u2013<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<ul>\n<li><code>swagger<\/code>: Tells which version of Swagger API is to be used<\/li>\n<li><code>info<\/code>: Tells the API information such as API version, documentation title, etc<\/li>\n<li><code>consumes<\/code>: Tells the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Basics_of_HTTP\/MIME_types\" target=\"_blank\" rel=\"noopener\">mime-type<\/a> which is to be expected by the API<\/li>\n<li><code>produces<\/code>: Tells what content type is expected by the API caller<\/li>\n<li><code>basePath<\/code>: Defines the API root\n<ul>\n<li>In our case, it will be &#8211; <code>\/api<\/code><\/li>\n<\/ul>\n<\/li>\n<li><code>paths<\/code>: Defines the application endpoints configuration<\/li>\n<li><code>get<\/code>: Defines the HTTP method for the given endpoint<\/li>\n<li><code>operationId<\/code>: Defines the python import path\/function (i.e. a handler file) that will respond to the given endpoint request. In our case,\n<ul>\n<li>The <code>\/api\/employee<\/code> endpoint will be responded by the <code>read_all(\u2026)<\/code> method written in the <code>employees.py<\/code> file<\/li>\n<li>Similarly the <code>\/api\/employee\/{employee_id}<\/code> endpoint will be responded by the <code>read_one(\u2026)<\/code> method written in the <code>employees.py<\/code> file<\/li>\n<\/ul>\n<\/li>\n<li><code>tags<\/code>: Define a grouping for the UI interface<\/li>\n<li><code>description<\/code>: Defines the implementation notes for the UI interface<\/li>\n<li><code>response<\/code>: Defines the beginning of the expected response section<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\"><em>swagger.yml<\/em><\/span><\/p>\n<pre class=\"brush:yml;\">swagger: '2.0'\ninfo:\n  version: 1.0.0\n  title: Python Swagger REST article\n  description: Swagger file that works in parallel with server to generate endpoints\nconsumes:\n  - application\/json\nproduces:\n  - application\/json\nbasePath: \/api\n# Paths supported by the server application\npaths:\n  \/employee:\n    get:\n      operationId: employees.read_all\n      tags:\n        - Employee\n      description: Read the list of employee\n      responses:\n        '200':\n          description: Successful read employee list operation\n          schema:\n            type: array\n            items:\n              properties:\n                id:\n                  type: string\n                first_name:\n                  type: string\n                last_name:\n                  type: string\n                joined_on:\n                  type: string\n  '\/employee\/{employee_id}':\n    get:\n      operationId: employees.read_one\n      tags:\n        - Employee\n      description: Read one employee from the list\n      parameters:\n        - name: employee_id\n          in: path\n          description: Employee id of the employee\n          type: string\n          required: true\n      responses:\n        '200':\n          description: Successful read employee from list operation\n          schema:\n            properties:\n              id:\n                type: string\n              first_name:\n                type: string\n              last_name:\n                type: string\n              joined_on:\n                type: string\n<\/pre>\n<h3>2.2 Creating a Handler for Application endpoints<\/h3>\n<p>Add the following code to the handler script containing the methods that will handle the request from the application endpoints. Each method name corresponds to the <code>operationId<\/code> defined in the <a href=\"#swagger-config-file\">swagger configuration file<\/a>. We are skipping the other REST operations (like POST, PUT, and DELETE) and only focusing on HTTP GET operation for brevity. You are free to add new endpoints and play around with them.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>employees.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># Modules\nfrom datetime import datetime\n\nfrom flask import abort\n\n\ndef get_timestamp():\n    return datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n\n\n# Mock employees data\nEMPLOYEES = {\n    '101': {\n        'id': '101',\n        'first_name': 'John',\n        'last_name': 'Doe',\n        'joined_on': get_timestamp()\n    },\n    '102': {\n        'id': '102',\n        'first_name': 'Maxim',\n        'last_name': 'Klee',\n        'joined_on': get_timestamp()\n    },\n    '103': {\n        'id': '103',\n        'first_name': 'Nonnah',\n        'last_name': 'Kirkland',\n        'joined_on': get_timestamp()\n    },\n    '104': {\n        'id': '104',\n        'first_name': 'Kit',\n        'last_name': 'Tite',\n        'joined_on': get_timestamp()\n    },\n    '105': {\n        'id': '105',\n        'first_name': 'Grannie',\n        'last_name': 'Coulman',\n        'joined_on': get_timestamp()\n    }\n}\n\n\n# Return all employees\ndef read_all():\n    print('Fetching all employees')\n    return [EMPLOYEES[key] for key in EMPLOYEES.keys()]\n\n\n# Return employee by id\ndef read_one(employee_id):\n    print('Finding employee id = {}'.format(employee_id))\n    for key in EMPLOYEES.keys():\n        if key == employee_id:\n            return EMPLOYEES[key]\n    else:\n        abort(404, 'Employee id = {} not found'.format(employee_id))\n<\/pre>\n<h3>2.3 Adding Connexion to the Server<\/h3>\n<p>Add the following code to the main script where will specify the swagger configuration file details to incorporate the connexion into the server. The application will create a connexion instance which in turn will create a Flask app internally but it will have some added functionalities.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>app.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># Modules\nimport connexion\nfrom flask import jsonify\n\n# Creating the application instance\napp = connexion.App(__name__, specification_dir='.\/configure')\n\n# Reading the swagger.yml file to configure the application endpoints\napp.add_api('swagger.yml')\n\n\n# Index endpoint\n# URL - http:\/\/localhost:5000\/\n@app.route('\/', methods=['GET'])\ndef home():\n    print('Showing the index message')\n    return jsonify({'message': 'Application is up and running'})\n\n\n# Driver code\nif __name__ == '__main__':\n    app.run(debug=False)\n<\/pre>\n<p>Run this python script and let us understand the output.<\/p>\n<h2>3. Swagger UI<\/h2>\n<p>To bring up the swagger on the browser hit the following endpoint &#8211; <code>http:\/\/localhost:5000\/api\/ui<\/code> and the application will bring up a page as shown in Fig. 2.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-flask-connexion-demo-img-guide-1.jpg\"><img decoding=\"async\" width=\"818\" height=\"274\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-flask-connexion-demo-img-guide-1.jpg\" alt=\"Python REST api - swagger ui\" class=\"wp-image-102132\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-flask-connexion-demo-img-guide-1.jpg 818w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-flask-connexion-demo-img-guide-1-300x100.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/python-flask-connexion-demo-img-guide-1-768x257.jpg 768w\" sizes=\"(max-width: 818px) 100vw, 818px\" \/><\/a><figcaption>Fig. 2: Swagger UI<\/figcaption><\/figure>\n<\/div>\n<p>The page displays the initial swagger interface and shows the list of endpoints supported by our application at the following endpoints &#8211; <code>http:\/\/localhost:5000<\/code>. This is built automatically by connexion when it parses the <code>swagger.yml<\/code> file. You are free to try the endpoints and play with them too. That is all for this tutorial and I hope the article served you with whatever you were looking for. Happy Learning and do not forget to share!<\/p>\n<h2>4. Summary<\/h2>\n<p>In this tutorial, we learned:<\/p>\n<ul>\n<li>Introduction to Flask micro-framework and Connexion in python programming<\/li>\n<li>Sample program create an application via the OpenAPI specifications<\/li>\n<\/ul>\n<p>You can download the source code of this tutorial from the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>5. More articles<\/h2>\n<ul>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/python-json-example\/\">Python JSON Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/introduction-to-the-flask-python-web-app-framework\/\">Introduction to the Flask Python Web App Framework<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/python-tutorial-for-beginners\/\">Python Tutorial for Beginners<\/a><\/li>\n<\/ul>\n<h2>6. Download the Project<\/h2>\n<p>This was a python programming tutorial to understand the connexion in python programming. This is extremely useful as it gives you and your API users a way to explore and experiment with the API without having to write any code.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/05\/Introduction-to-Python-REST-API.zip\" target=\"_blank\" rel=\"noopener\"><strong>Introduction to Python REST API<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks. Flask is a micro-framework as it does not require any particular tools or libraries. It has no database layer, form validations, or any other third-party library that provides &hellip;<\/p>\n","protected":false},"author":119,"featured_media":99891,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46689],"tags":[46704,1716,1744],"class_list":["post-102130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-openapi","tag-python","tag-swagger"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Introduction to Python REST API - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to Python REST API - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-10T08:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\"},\"author\":{\"name\":\"Yatin\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13\"},\"headline\":\"Introduction to Python REST API\",\"datePublished\":\"2021-05-10T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\"},\"wordCount\":962,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"keywords\":[\"OpenAPI\",\"python\",\"swagger\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\",\"name\":\"Introduction to Python REST API - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"datePublished\":\"2021-05-10T08:00:00+00:00\",\"description\":\"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"set python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Introduction to Python REST API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13\",\"name\":\"Yatin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"caption\":\"Yatin\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Introduction to Python REST API - Java Code Geeks","description":"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.","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:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to Python REST API - Java Code Geeks","og_description":"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.","og_url":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-05-10T08:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","type":"image\/jpeg"}],"author":"Yatin","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/"},"author":{"name":"Yatin","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13"},"headline":"Introduction to Python REST API","datePublished":"2021-05-10T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/"},"wordCount":962,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","keywords":["OpenAPI","python","swagger"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/","url":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/","name":"Introduction to Python REST API - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","datePublished":"2021-05-10T08:00:00+00:00","description":"Hello! This is an introduction to Python REST API. I\u2019ll show you how to create RESTful web services in python by using the Flask and Connexion frameworks.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","width":150,"height":150,"caption":"set python"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/introduction-to-python-rest-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/"},{"@type":"ListItem","position":3,"name":"Python","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/"},{"@type":"ListItem","position":4,"name":"Introduction to Python REST API"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13","name":"Yatin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","caption":"Yatin"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/119"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=102130"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102130\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/99891"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=102130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=102130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=102130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}