# API

## Login User

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/login`

This endpoint allows users to login

#### Headers

| Name         | Type   | Description             |
| ------------ | ------ | ----------------------- |
| content-type | string | set to application/json |

#### Request Body

| Name     | Type   | Description      |
| -------- | ------ | ---------------- |
| password | string | Password of user |
| email    | string | Email of user    |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "user": {
        "username": "prabbit",
        "status": true,
        "profileImage": "https://www.google.com",
        "_id": "5ad43ff2d6813a02b4afb999",
        "password": "$2a$10$aZcRatR7HO3WX.6j/9DxaetRI7KXhKly0O0x9BWmkcNOBcLbaWVOi",
        "email": "prabbit@gmail.com",
        "firstName": "Peter",
        "lastName": "Rabbit",
        "__v": 0
    },
    "userDetail": {
        "username": "prabbit",
        "location": "gardens",
        "roles": ["programmer"],
        "description": "hello this is peter, the rabbit!",
        "techstack": [
            "javascript",
            "HTML/CSS",
            "react",
        ],
        "projects": [
            "5ae2d7189b979d4cf889562"
        ],
        "bookmarked": [],
        "linkedInLink": "https://www.google.com",
        "githubLink": "https://www.google.com",
        "portfolioLink": "https://www.google.com",
        "websiteLink": "https://www.google.com",
        "twitterLink": "https://www.google.com",
        "blogLink": "https://www.blog.com",
        "_id": " 5ad43ff2d6813a02b4afb999",
        "__v": 10
    },
    "message": "Successfully logged in"
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```javascript
{
    "message": "User Not Found with Email"
}
```

{% endtab %}
{% endtabs %}

## Register New User

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/signup`

This endpoint allows new users to register to site

#### Headers

| Name         | Type   | Description             |
| ------------ | ------ | ----------------------- |
| content-type | string | set to application/json |

#### Request Body

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| password  | string | Password    |
| email     | string | Email       |
| username  | string | Username    |
| lastName  | string | Last Name   |
| firstName | string | First Name  |

{% tabs %}
{% tab title="200 " %}

```
{
    "user": {
        "username": "prabbit",
        "status": true,
        "profileImage": "",
        "_id": "5aecb8f101c8580659c7bf80",
        "password": "$2a$10$WJHuTqKRSkv6LTzj3smCouHYLBnRNKKaws8UIq7cl3LvURpMQ6Iy.",
        "email": "prabbit@gmail.com",
        "firstName": "peter",
        "lastName": "rabbit",
        "__v": 0
    },
    "userDetail": null,
    "message": "User Registration Succesful"
}
```

{% endtab %}

{% tab title="404 If email is not written or username/email is already used." %}

```
{
    "message": "Missing credentials"
}
```

{% endtab %}
{% endtabs %}

## Google Login

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/googlelogin`

Login with Google Authentication

#### Path Parameters

| Name    | Type   | Description                            |
| ------- | ------ | -------------------------------------- |
| idToken | string | idToken passed in from Google function |

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| content-type | string | application/json |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Logout User

<mark style="color:blue;">`GET`</mark> `https://projectmatch.me/api/logout`

Signs out current user

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Forgot Password

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/forgot`

Sends an email to passed in email parameter to start the process of re-setting the user password

#### Path Parameters

| Name  | Type   | Description   |
| ----- | ------ | ------------- |
| email | string | email of user |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Reset Password

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/reset/:token`

Resets the password

#### Path Parameters

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| token | string |             |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Get All Users

<mark style="color:blue;">`GET`</mark> `https://projectmatch.me/api/users`

Returns a list of all users

{% tabs %}
{% tab title="200 " %}

```
 
```

{% endtab %}
{% endtabs %}

## Get One User

<mark style="color:blue;">`GET`</mark> `https://projectmatch.me/api/user/:username`

Returns individual user data

#### Path Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| username | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Delete User

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/user/delete`

Deletes user

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| password | string |             |
| username | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## De-activates user

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/user/deactivate`

De-activates user

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| password | string |             |
| username | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Activates user

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/user/activate`

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| username | string |             |
| password | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Update User Data&#x20;

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/user/update`

Updates User Data

#### Request Body

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| profileImage  | string |             |
| email         | string |             |
| lastName      | string |             |
| firstName     | string |             |
| blogLink      | string |             |
| twitterLink   | string |             |
| websiteLink   | string |             |
| portfolioLink | string |             |
| githubLink    | string |             |
| linkedInLink  | string |             |
| bookmarked    | array  |             |
| techstack     | array  |             |
| description   | string |             |
| roles         | array  |             |
| location      | string |             |
| \_id          | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Gets All Projects

<mark style="color:blue;">`GET`</mark> `https://projectmatch.me/api/projects`

Get's all projects

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Add New Project

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/projects/add`

Adds new project

#### Request Body

| Name        | Type    | Description |
| ----------- | ------- | ----------- |
| creator     | string  |             |
| contact     | string  |             |
| tags        | array   |             |
| category    | string  |             |
| status      | boolean |             |
| lookingFor  | array   |             |
| liveLink    | string  |             |
| mockupLink  | string  |             |
| githubLink  | string  |             |
| team        | array   |             |
| dueDate     | string  |             |
| description | string  |             |
| name        | string  |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Updates Project

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/projects/update/:id`

Updates project per \_id parameter

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | project id  |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Delete a Project

<mark style="color:red;">`DELETE`</mark> `https://projectmatch.me/api/projects/delete`

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | project id  |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Upload Profile Image

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/image/profile`

Uploads user profile image to AWS and saves it to corresponding user model

#### Path Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| userName | string |             |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Upload Project Cover Photo

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/image/project`

Uploads project cover photo to AWS and saves it to corresponding project model

#### Path Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| projectId | string |             |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Upload Project Revision Image

<mark style="color:green;">`POST`</mark> `https://projectmatch.me/api/image/revision`

Uploads project revision images to AWS and saves it to corresponding revision model

#### Path Parameters

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| revisionNumber | string |             |
| user           | string |             |
| projectId      | string |             |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}
