7 HTTP methods with Story Telling for API Testers
While working with APIs, we have to understand the concept of HTTP methods which are frequently used in the project.
Let’s understand them with story telling twist.
1. GET
Imagine you walk into a library and ask the librarian to fetch a specific book for you. The GET method is similar; it’s used to request data from a server.
~ When you send a GET request to an API endpoint, you’re asking the server to retrieve the requested information, like fetching a book from the shelves.
2. POST
Picture yourself sending a letter to a company with a new order request. The POST method is used to send data to a server to create a new resource.
~ When you send a POST request, you’re submitting information (like order details) to the server, which then processes and stores it, creating a new resource in the system.
3. PUT
Think of a gardener replacing an old plant with a new one in the same spot. The PUT method is used to update an existing resource or create a new one if it doesn’t exist.
~ When you send a PUT request, you’re providing the complete information for the resource, either updating it if it’s already there or creating it if it’s not.
4. DELETE
Imagine you have a document you no longer need, and you shred it to dispose of it. The DELETE method is used to remove a resource from the server.
~ When you send a DELETE request, you’re instructing the server to delete the specified resource, just like getting rid of an unwanted document.
5. PATCH
Consider making minor edits to a draft document without rewriting the entire thing. The PATCH method is used for partial updates to a resource.
~ When you send a PATCH request, you’re providing only the changes you want to make, updating specific fields rather than replacing the whole resource.
6. HEAD
Think of checking the table of contents of a book without reading the whole book. The HEAD method is similar to GET, but it only requests the headers and status line, not the body of the resource.
~ When you send a HEAD request, you’re asking for metadata about the resource, useful for checking if it exists or if it’s been modified.
7. OPTIONS
Imagine you are at a restaurant and you ask the waiter what dishes are available. The OPTIONS method is used to describe the communication options for the target resource.
~ When you send an OPTIONS request, the server responds with the HTTP methods that are supported for that resource, helping you understand what actions you can perform.
What’s your frequently used HTTP method in API Testing ?
Swaroop Nadella
Test Automation Engineer, Tech Educator
Subscribe here, to Get an email whenever I publish article on Medium
Core Java and Coding for Automation Testers — Udemy Course
Swaroop Nadella Academy Store — Quizzes and Courses