This activity will help you learn how to use Postman and test APIs. You will practice creating collections, adding requests, and testing API responses. It will also teach you how to debug and check API results.
What is POSTMAN?
- Postman is like a handy toolbox have a screw, hammer, nail for developers or us working with APIs. It makes it easy to design, test, and document APIs all in one place. With its user-friendly interface, you can send requests, check responses, and even automate tasks. It's a go-to tool for developers and teams to work smarter and faster on anything API-related.
To give you a simple analogy for better understanding of POSTMAN, think of Postman as a "universal remote control" for interacting with APIs. Just like a remote lets you test different functions on your TV such include of volume, enter, the number and so on. Postman allows you to send various requests (like GET, POST, PUT) to an API and see how it responds. It helps developers understand and test how their "digital devices" (APIs) work behind the scenes. It’s like need to request first corresponding on the feedback or the response of server in client.
Some of them are confused why need or necessarily need to test APIs instead we may direct to request and so on, this is explanation why we need to test first API
Why we need TEST API?
Testing APIs is crucial because they act as the "middleman" between different software systems. Imagine trying to use a feature in an app, like logging in or checking an order status, and the communication between the app and the server fails. That’s where APIs come in. Testing them ensures they work properly, so they return the right data or perform the correct actions every time.
For example, if you’re creating a shopping app, you need to test the API that handles transactions to make sure it processes payments correctly, returns accurate order details, and doesn’t let anyone bypass security measures. Without this testing, errors like incorrect charges or unauthorized access can happen, causing frustration and security risks.
API testing also helps catch issues early, preventing bigger problems down the road. For instance, if a bug is found in the way data is sent from one system to another, you can fix it before it becomes a bigger issue. This is especially important as more and more apps depend on third-party APIs, like payment systems or social media logins, which need to integrate seamlessly.
In addition to catching bugs, API testing also ensures your system can handle large amounts of traffic. For example, during a sale or event, if your website or app experiences a sudden spike in users, you want to ensure the API can still respond quickly and accurately. If it doesn’t, users might experience delays or crashes.
Lastly, API testing supports continuous development. As developers update or add new features to an app, API tests help ensure that those changes don’t break anything else. This way, APIs remain reliable, secure, and user-friendly—keeping everything running smoothly for both developers and end-users.
STEP-BY-STEP TO LEARN TESTING API with POSTMAN
- First, if you haven’t yet a POSTMAN in your desktop, you download first so, you can follow there corresponding processes:
POSTMAN DOWNLOAD: Download Postman | Get Started for Free
Once, you already have this, open the postman and follow the instruction and POSTMAN need an account, in my case, I use my google account.
Since, I have already exist account the direct POSTMAN in the browser screen will be this. Just choose the account and go back in your POSTMAN App.
Now as to learn, we try to add collection like this:
ADD COLLECTION
The collection are already in the POSTMAN as the provided information in activity.
In below every collection said, “This collection is empty” Add a request to start working, means we do not yet take an action request that’s why the screen is in this at the moment.
ADD A REQUEST EVERY COLLECTION
Once you already have a collection, now request every collection. Let’s explore the possible response of each,
USER
USING POST REQUEST
as you can see, we received a 500 http status codes that means the request can’t be read and there’s a mis configure about the processing.
Let’s try now the PUT REQUEST in user
as you can see, the PUT REQUEST we request in user response of 404 http status code that means the parameter of the body request can’t be reach or there’s no information are in the database.
Now, try DELETE request
The DELETE we practice are usually not give a body response since we want to delete, but in this case, there’s no anybody context in the request but we can be able to identify in the URL we have by SPECIFIED UUID. In addition, that’s why we receive a 204 NO CONTENT http status code.
Let’s try now GET USER by ID
As you can see, by putting UUID in the URL we have, we provide the connected and related info about the information of specific people. In this case we target the UUID which are very unique every user. In addition, we receive a 200 OK which mean the REQUEST ARE SUCCESSFUL AND it return to client as also SUCCESFUL.
Now using GET by users
As you can see, we receive a 200 OK which means also, the request is successful and its response as successful. But in this case, the database is empty that’s why the fetching data is empty and result of [].
Now, let’s proceed on the restaurant category. Make the request in this collection of what I did and let each of them use to understand it’s features and function.
RESTAURANT_CATEGORY
Using POST REQUEST
With this URLs which belong restaurant_categories, the request body looking for name of “cafe” with a POST request, the response of the server is only who belong with the name of “cafe” which shown below with a id, uuid, created at, and so on.
Using PUT or UPDATE REQUEST
As you can see the name “rona_decio_2” are response with 404 NOT FOUND means the parameter request can’t be reach or not existing in the database. Therefore, the Update are not applied.
Using DELETE REQUEST
As on DELETE Request, it found a 404 NOT found http status code means even the UUID indicate are URL, the provide information are not existing so therefore, no data can be delete.
Using GET (get all restaurant category)
As you can see, with a request URL of with no body context, https://testsvfcb.pythonanywhere.com/restaurant-category, all information include of each unique id, uuid, name, and so on within the restaurant-category will show as a response of a server using GET REQUEST. and get A 200 OK means that the request are successfully reach and it response successfully in the client.
How about now get through their ID?
Using GET (Get_restaurant_category_by_id)
So the UUID belong in the URLs are not found so we received as response of 404 NOT FOUND http status code, base on the documentation there’s a typo with the domain “.comm” instead of “.com” so it can be result like this:
Let’s change the UUID in the URL which exist in the information or data base:
As you can see the one of the information in the database, let’s try use the information with a category_id 6 of it’s UUID. “
d04af782-5284-432a-9548-b1b6594f8e1d
The URL like this now “https://testsvfcb.pythonanywhere.comm/restaurant-category/d04af782-5284-432a-9548-b1b6594f8e1d”
As you can see the information belong on the mentioned UUID are shown as response of the server. This is very important of what are we want request specifically in the API.
Now Let’s Try in another collection, same process with the request.
COLLECTION (RESTAURANT)
Let’s now add restaurant
POST REQUEST (ADD RESTAURANT)
As the image above. we receive a 201 CREATED http status codes that means the request are readable and it also successfully added in the database. The UUID will be replace in the PUT or update method
PUT/ UPDATE restaurant REQUEST
As you can see, the difference between in POST AND PUT REQUEST WE CHANGE THE NAME FROM RESTAURANT 4 TO RESTAURANT 5, for the reason we use the UUID to access them and applied the changes. 200 OK means between request and response are successfully interact.
DELETE REQUEST (delete_restaurant_category)
You receive the 404 NOT FOUND if the URL is invalid, let’s try the sample information we have and put in the URLs
https://testsvfcb.pythonanywhere.com/restaurant/3f94bb5e-aeb6-4db8-9b04-c2e4e5af6f85 we use the UUID and we test to delete it.
See now, we successfully delete it and there’s no respond in the server as needed 204 NO CONTENT http status code.
USING GET REQUEST (Get_restaurant_by_id)
You can also get the information not by ID, but best practices use ID AND UUID since it’s unique every information, you can use name also depends on the condition requirements needed to request. 200 OK means client and server are successfully interacted.
How about GET REQUEST (Get All restaurant)
Using this URL, restaurant, it general that we want to get all information under of restaurant categories. 200 OK means client request and server response are successfully interacted.
MOVE ON, LET’S ANOTHER IN COLLECTION
MENU_CATEGORY
USING POST REQUEST (add menucategory)
Through the body request of client, it sends on the server and respond it of what request. 201 CREATED http codes mean the request are successfully created in the server side and response it as a result of information provided belong in the name such as created, the id, created, and so on.
PUT OR UPDATE REQUEST (update_restaurant_category)
As you can see, the image above response of 404 NOT FOUND because the UUID belong in the URL do not exist and can’t be able to update in empty.
USING DELETE REQUEST (delete_restaurant_category )
Same in DELETE request, as you can see 404 NOT FOUND so the parameter or UUID can’t found and reached.
GET REQUEST ( Get_restaurant_category_by_id)
Same 404 NOT FOUND https codes that what we can get if the information in the URL is not found or exist due to some reason like move, rename and so on.
GET REQUEST (Get All menu_category )
Mostly GET request the category is always a 200 OK or successfully operation it’s only fetch data in the end. But to make significant and no doubts about the 404 NOT FOUND IN PUT, DELETE, AND GET BY ID
Let’s use a valid UUID
PUT/UPDATE REQUEST (UUID used e6af352a-a38e-4a9e-bc7f-604f397e7562)
Current state
After Update
DELETE REQUEST (UUID used: 91a9e322-a27f-4853-8111-400b723ba21d)
Current State
After Changes (State)
GET REQUEST BY ID (UUID used: 91a9e322-a27f-4853-8111-400b723ba21d )
Current State
The Response of Server
Now, Let’s Proceed on the next collection
MENU (COLLECTION)
Using Post REQUEST (menu)
As you can see, we want to add the body request in the menu using POST request, now 500 http status codes shown that means can’t put in the table or database or the table itself are not existing. In this case, the restaurant_id and category_id are not existing in the table so it can able to distinguish the parameter.
Using PUT/UPDATE request (update_menu )
As you can see, 422 UNPROCESSABLE ENTITY does mean that USING PUT REQUEST, you can’t able or have a response to the server to update without the whole information such as availability, category_id, description, price, and restaurant_id. you can’t change the name without the whole information or section.
Using DELETE REQUEST (delete_menu)
Since the UUID indicate in the URLs are not exist;
But when we use a valid UUID, it shows like this:
UUID used
9d2d6c88-bc0f-49fb-9223-84c1e9c48d9e
After Changes
204 NO CONTENT indicate that your request has successfully read by the server with no response because it not needed for deletion.
Using GET Request ( Get_menu_by_id)
UUID used valid: 46fc6fd6-4235-4fae-bd55-b7571acbe690
200 OK means client request and server response successfully interact.
How about now GET Request (get all menu by restaurant)
As you see, it shows the all information under the menu of the restaurant. 200 OK means success interaction between client and server.
USING GET REQUEST TO SHOW HELLO WORLD
CONCLUSION:
As our conclusion and reflection, Knowing HTTP codes and how requests work in APIs is super important if you want to build or work with apps that talk to each other. HTTP codes, like 200 (all good) or 404 (not found), quickly tell you what’s happening with your request whether it worked, failed, or ran into a server problem. On top of that, understanding how to use requests like GET to fetch data or POST to add new stuff makes sure you’re communicating with the API the right way.
It will be the great help to the software development who use of APIs connecting to the front and back-end development to understand what these discussion or topics are we did and have <3 < 3 <3