Skip to main content

Command Palette

Search for a command to run...

Activity 34: Test API in POSTMAN

Published
2 min read
Activity 34: Test API in POSTMAN

POSTMAN

Add 6 Collection

  • Add Collection 1: User

  • Add Collection 2: Restaurant Category

  • Add Collection 3: Restaurant

  • Add Collection 4: Menu Category

  • Add Collection 5: Menu

  • Hello World (GET)


Step-by-Step Procedure :

Open Postman

  • Launch Postman application

Create Collection

  • Add Collection 1: User

  • Add Collection 2: Restaurant Category

  • Add Collection 3: Restaurant

  • Add Collection 4: Menu Category

  • Add Collection 5: Menu

  • Hello World (GET)


USER Request:

https://testsvfcb.pythonanywhere.com/users/

(POST) create_user:

POST Method – Creating Data

The POST method is used to create new resources on the server. It sends data to the server to create a new record (e.g., creating a new user, adding a new item to a menu, etc.).

sample code:

{
  "username": "alicecooper123",
  "email": "alice.cooper@example.com",
  "password": "securePassword123",
  "role": "user"
}

Response:

{
    "created_at": "2024-11-29T11:54:55",
    "deleted_at": null,
    "email": "alice.cooper@example.com",
    "role": "user",
    "updated_at": "2024-11-29T11:54:55",
    "user_id": 120,
    "user_uuid": "6db66306-d5ad-41c8-900b-725db15bf998",
    "username": "alicecooper123"
}

OUTPUT:


(PUT) update_user:

PUT Method – Updating Data

The PUT method is used to update an existing resource on the server. It replaces the current state of a resource with the data provided in the request.

sample code:

{
  "username": "jhayr1231",
  "email": "jhayr1231@gmail.com",
  "password": "securePassword123",
  "role": "admin"
}

Response:

{
    "created_at": "2024-11-29T12:26:52",
    "deleted_at": "2024-11-29T12:45:54",
    "email": "jhayr1231@gmail.com",
    "role": "admin",
    "updated_at": "2024-11-29T12:54:19",
    "user_id": 125,
    "user_uuid": "d2d97ebd-a0df-4ab4-a0a9-994d39da3d86",
    "username": "jhayr1231"
}

OUTPUT:


(DELETE): Delete User

DELETE Method – Deleting Data

The DELETE method is used to remove a resource from the server. It deletes the specified resource, such as a user or an item from the menu.

sample code:

{
  "username": "alicecooper123",
  "email": "alice.cooper@example.com",
  "password": "securePassword123",
  "role": "user"
}

Response:

OUTPUT:


(GET) user_by_Id

GET Method – Retrieving Data

The GET method is used to retrieve data from the server. It is typically used to get information about resources (e.g., a list of users, details of a single user, etc.) without modifying the server's data.

(GET) Get All Users


REFERENCE: https://activity.thirdygayares.com/default-guide/system-integration-and-architecture/postman

https://documenter.getpostman.com/view/24626304/2sAYBUDXqC#bc3cede6-8cff-4e19-8274-9ddd74e00a8c

POSTMAN: https://www.postman.com/spaceflight-saganist-20962227/my-workspace/collection/fo4x7aq/sample-postman-only?action=share&creator=38961272