IdeasUi Logo Shahadath - Blog

7 HTTP methods with Story Telling for API Testers!

7 HTTP methods with Story Telling for API Testers! image

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.