> For the complete documentation index, see [llms.txt](https://ios-course.cornellappdev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ios-course.cornellappdev.com/resources/tool-guides/postman.md).

# Postman

Creator: Vin Bui (FA 23) | Editor: Jay Zheng (FA25)

Postman is an API platform used by developers to test API calls. It is a powerful tool that we can use to build and design APIs.

### Installation

You can download Postman [here](https://www.postman.com/). Once it’s installed, create an account.

### Getting Started

1. To get started, create a **Blank Workspace.** Give it a name and set the access scope to whatever you like.

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2F09uDWzfU49hXUj6t5da0%2Fimage.png?alt=media&amp;token=0b2fcb28-15fd-4fcc-9679-ac1267926924" alt=""><figcaption></figcaption></figure>

2. Make sure the **Collections** tab is selected, then click the `+` button to create a new collection.

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2FfFpkx6xIc4DD5S8MbyLG%2Fimage.png?alt=media&amp;token=8f8dd295-769a-4094-9ba9-ae150e42b9f9" alt=""><figcaption></figcaption></figure>

2. To add requests to this collection, click on the `+` .

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2F6KljRZob88L9pVBH5RRx%2Fimage.png?alt=media&amp;token=81e8fce2-e78c-45ea-be74-9c4ec235174e" alt=""><figcaption></figcaption></figure>

### Creating a Request

1. Click on the `+` next in the tab.
2. Give it any name you want.
3. Select the request type: GET, POST, etc.
4. Enter the endpoint URL.
5. (Optional) Provide a request body or input query parameters.
   1. For the request body, select **Body > Raw > JSON**. Then input body parameters in JSON format.
6. Click send to send the request

### Examples

#### GET Request&#x20;

* URL Link is deprecated, but you can follow the same procedure with the assignment 3 [A3: ChatDev](/resources/archived-past-semesters/fa25/assignments/a3-chatdev.md#part-iii-fetching-posts)

```
## fetch
GET: https://ios-course-backend.cornellappdev.com/api/posts/

## make a post
POST: https://ios-course-backend.cornellappdev.com/api/posts/create/

## like a post
POST: https://ios-course-backend.cornellappdev.com/api/posts/{postId}/like/
```

Let’s fetch the FA23 AppDev Roster: <https://ioscourse-g3jtiqqehq-ue.a.run.app>

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2FN3bu90sHHlSt3GRCjgVK%2FUntitled.png?alt=media&amp;token=207771c2-1d27-4b31-9c9f-2a9965aff04f" alt=""><figcaption></figcaption></figure>

This is a GET request that does not take in any query parameters or request body. You can also see the status of the request (”200 OK”).

#### POST Request

Let’s add a new member to the roster:<https://ioscourse-g3jtiqqehq-ue.a.run.app>

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2FX2JXXhYJz9w2Zgr4goIy%2FScreenshot%202023-07-18%20at%2011.24.14%20PM.png?alt=media&amp;token=1c879e03-3bc6-4845-a877-7a30711881ee" alt=""><figcaption></figcaption></figure>

This is a POST request that takes in a request body in the above JSON format. The server responds with a 200 status code and the member that we added.

If we tried to provide an invalid request, then the server responds with a 400 Bad Request status code and an error message.

<figure><img src="https://1509678725-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lwk7443W4ukbAF9S07e%2Fuploads%2FlJfBLqfhPOr42Wc0tlxA%2FUntitled.png?alt=media&amp;token=a881bd54-b65b-4a21-88c8-8cc1e47f568e" alt=""><figcaption></figcaption></figure>
