---
# System prepended metadata

title: FSE SB1 API Design Doc - Aishwarya Iteration 4

---

# FSE SB1 API Design Doc - Aishwarya Iteration 4
> API Design Ref: [ESN REST API Sample](https://docs.google.com/spreadsheets/d/1aHaiGxGVdY-UrNUoj1SaZdNqx7HnisuxNiucPQXcJE0/edit#gid=1001548426)


[TOC]


## Donation API
> Need JWT Auth for API Call

### Create Donation Entry

#### Route
```
POST /api/donations
```

#### Payload

```json
{
    resource: string,
    quantity: integer,
}
```

#### Response

##### Code 201 OK
```json
{
    type: DONATION, // enum
    data: {
       donation: [
           {
              username: string,
              resource: string,
              status: string,
              quantity: number,
           },
       ],
    },
    message: string
}
```

### Get Resources

#### Route
> Get all donations for a user
```
GET /api/donations?username=${username} 
```
> Get donations of all users except testUser
```
GET /api/donations?exclude=${username}
```

#### Payload
> N/A

#### Response

##### Code 200 OK
```json
{
    type: DONATION, // enum
    data: {
       donations: [
           {
              username: string,
              quantity: number,
              status: string,
              resource: string,
           },
           ...
       ],
    },
    message: string
}
```

### Update Resource Status

#### Route

```
PUT /api/donations/${username}/${resource}/${quantity}/${status}
```

#### Payload
> N/A

#### Response

##### Code 200 OK
```json
{
    type: DONATION, // enum
    data: {
       donation: [
           {
              username: string,
              status: string,
              resource: string,
           },
           ...
       ],
    },
    message: string
}
```

## ChatRoom API
> Need JWT Auth for API Call

### Get ChatRoom By Members

#### Route
```
GET /api/messages/private/chatrooms/members/?sender=${sender_name}&receiver=${receiver_name}
```

#### Payload
> N/A

#### Response

##### Code 200 OK
```json
{
    type: CHAT, // enum
    data: {
       donation: [
           {
              _id: ObjectID,
              members: string array,
           },
           ...
       ],
    },
    message: string
}
```

