{"id":153,"date":"2026-03-02T18:29:19","date_gmt":"2026-03-02T13:29:19","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=153"},"modified":"2026-03-17T08:28:24","modified_gmt":"2026-03-17T03:28:24","slug":"http-methods","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/","title":{"rendered":"HTTP Methods"},"content":{"rendered":"\n<p>HTTP Methods define the type of action a client (browser or app) wants to perform on a server.<\/p>\n\n\n\n<p>Whenever you interact with a website or API, HTTP methods are used behind the scenes to send requests and receive responses.<\/p>\n\n\n\n<p>HTTP stands for <strong>HyperText Transfer Protocol<\/strong> \u2014 the communication protocol between client and server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why HTTP Methods Are Important<\/h2>\n\n\n\n<p>HTTP methods tell the server what to do with the requested resource.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Retrieve data<\/li>\n\n\n\n<li>Send new data<\/li>\n\n\n\n<li>Update existing data<\/li>\n\n\n\n<li>Delete data<\/li>\n<\/ul>\n\n\n\n<p>Each method has a specific purpose.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. GET<\/h2>\n\n\n\n<p>GET is used to retrieve data from the server.<\/p>\n\n\n\n<p>It does not modify data.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>GET \/users<br>GET \/products\/1<\/p>\n\n\n\n<p>Use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Viewing a webpage<\/li>\n\n\n\n<li>Fetching user details<\/li>\n\n\n\n<li>Loading product listings<\/li>\n<\/ul>\n\n\n\n<p>GET requests:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data is sent in the URL<\/li>\n\n\n\n<li>Can be cached<\/li>\n\n\n\n<li>Should not change server data<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. POST<\/h2>\n\n\n\n<p>POST is used to send new data to the server.<\/p>\n\n\n\n<p>It is commonly used to create resources.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>POST \/users<\/p>\n\n\n\n<p>Use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Submitting a registration form<\/li>\n\n\n\n<li>Creating a new account<\/li>\n\n\n\n<li>Uploading data<\/li>\n<\/ul>\n\n\n\n<p>POST requests:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data is sent in the request body<\/li>\n\n\n\n<li>Not cached by default<\/li>\n\n\n\n<li>Can change server data<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">3. PUT<\/h2>\n\n\n\n<p>PUT is used to update existing data.<\/p>\n\n\n\n<p>It replaces the entire resource.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>PUT \/users\/1<\/p>\n\n\n\n<p>Use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Updating profile information<\/li>\n\n\n\n<li>Modifying product details<\/li>\n<\/ul>\n\n\n\n<p>PUT requests:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Sent in request body<\/li>\n\n\n\n<li>Replaces full resource<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">4. PATCH<\/h2>\n\n\n\n<p>PATCH is used to partially update data.<\/p>\n\n\n\n<p>Unlike PUT, it updates only specific fields.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>PATCH \/users\/1<\/p>\n\n\n\n<p>Use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Updating only email address<\/li>\n\n\n\n<li>Changing password<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. DELETE<\/h2>\n\n\n\n<p>DELETE is used to remove data from the server.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>DELETE \/users\/1<\/p>\n\n\n\n<p>Use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deleting user account<\/li>\n\n\n\n<li>Removing product from database<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Safe vs Unsafe Methods<\/h2>\n\n\n\n<p>Safe methods (do not change server data):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GET<\/li>\n<\/ul>\n\n\n\n<p>Unsafe methods (modify data):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>POST<\/li>\n\n\n\n<li>PUT<\/li>\n\n\n\n<li>PATCH<\/li>\n\n\n\n<li>DELETE<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Idempotent Methods<\/h2>\n\n\n\n<p>An idempotent method produces the same result no matter how many times it is repeated.<\/p>\n\n\n\n<p>Idempotent:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GET<\/li>\n\n\n\n<li>PUT<\/li>\n\n\n\n<li>DELETE<\/li>\n<\/ul>\n\n\n\n<p>Not idempotent:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>POST<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Real-World Example<\/h2>\n\n\n\n<p>Login process:<\/p>\n\n\n\n<p>POST \/login \u2192 Send username and password<\/p>\n\n\n\n<p>Viewing profile:<\/p>\n\n\n\n<p>GET \/profile<\/p>\n\n\n\n<p>Updating profile:<\/p>\n\n\n\n<p>PUT \/profile<\/p>\n\n\n\n<p>Deleting account:<\/p>\n\n\n\n<p>DELETE \/account<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Key Takeaway<\/h2>\n\n\n\n<p>HTTP Methods define the action performed on a server resource.<\/p>\n\n\n\n<p>GET retrieves data.<br>POST creates data.<br>PUT updates data.<br>PATCH partially updates data.<br>DELETE removes data.<\/p>\n\n\n\n<p>Understanding HTTP methods is essential for working with web applications and APIs.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773718215300\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FOR WEB DEVELOPMENT (PYWEB) > Web Basics > HTTP Methods<\/span><\/span><\/div>","protected":false},"menu_order":83,"template":"","class_list":["post-153","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HTTP Methods - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/http-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTTP Methods - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/http-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-17T03:28:24+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/http-methods\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/http-methods\\\/\",\"name\":\"HTTP Methods - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-02T13:29:19+00:00\",\"dateModified\":\"2026-03-17T03:28:24+00:00\",\"description\":\"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/http-methods\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/http-methods\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/http-methods\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FOR WEB DEVELOPMENT (PYWEB) > Web Basics > HTTP Methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTTP Methods - One Language. Endless Possibilities","description":"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently","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:\/\/gigz.pk\/python\/lesson\/http-methods\/","og_locale":"en_US","og_type":"article","og_title":"HTTP Methods - One Language. Endless Possibilities","og_description":"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently","og_url":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-17T03:28:24+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/","url":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/","name":"HTTP Methods - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-02T13:29:19+00:00","dateModified":"2026-03-17T03:28:24+00:00","description":"Learn HTTP methods: GET, POST, PUT, PATCH, DELETE to retrieve, create, update, or delete data in web apps and APIs efficiently","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/http-methods\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/http-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FOR WEB DEVELOPMENT (PYWEB) > Web Basics > HTTP Methods"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}