# Methods

## Get User

<mark style="color:blue;">`GET`</mark> `https://fixer-uppers-api.azurewebsites.net/user/:id`

This endpoint allows you to retrieve user information

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | ID of the user |

{% tabs %}
{% tab title="200 User successfully retrieved" %}

```
User object
```

{% endtab %}

{% tab title="404 Could not find a user matching this ID" %}

```
{
    "message": "User not found"
}
```

{% endtab %}
{% endtabs %}

## Get Badge

<mark style="color:blue;">`GET`</mark> `https://fixer-uppers-api.azurewebsites.net/badge/:id`

This endpoint allows you to retrieve badge details

#### Path Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| id   | string | ID of the badge |

{% tabs %}
{% tab title="200 Badge successfully retrieved" %}

```
Badge Object
```

{% endtab %}

{% tab title="404 Could not find a badge matching this ID" %}

```
{
    "message": "Badge not found"
}
```

{% endtab %}
{% endtabs %}

## Create Listing

<mark style="color:green;">`POST`</mark> `https://fixer-uppers-api.azurewebsites.net/create-listing`

This endpoint allows a user to create a listings

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| authorisation | string | Author's user ID |

#### Request Body

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| title         | string | Listing title                                  |
| description   | string | Listing description                            |
| listing\_type | string | The type of listing, as defined by ListingType |

{% tabs %}
{% tab title="200 Listing successfully created. This response contains the new listing ID in the body" %}

```
{
    "message": "Listing successfully created",
    "id": listing ID
}
```

{% endtab %}
{% endtabs %}

## Search Resources

<mark style="color:blue;">`GET`</mark> `https://fixer-uppers-api.azurewebsites.net/search`

This endpoint allows you to retrieve listings in your local area

#### Path Parameters

| Name  | Type   | Description       |
| ----- | ------ | ----------------- |
| query | string | The search string |

{% tabs %}
{% tab title="200 Successfully retrieved search results" %}

```
Array of Resource objects
```

{% endtab %}
{% endtabs %}

## Get Listings

<mark style="color:blue;">`GET`</mark> `https://fixer-uppers-api.azurewebsites.net/listings`

This endpoint allows you to retrieve all open listings

{% tabs %}
{% tab title="200 Successfully retrieved listings
Note: If no listings are found, this will return an empty array" %}

```
Array of listing objects
```

{% endtab %}
{% endtabs %}

## Get Listing

<mark style="color:blue;">`GET`</mark> `https://fixer-uppers-api.azurewebsites.net/listing/:id`

This endpoint allows you to retrieve details for a single listing

#### Path Parameters

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

{% tabs %}
{% tab title="200 Successfully retrieved listing" %}

```
Listing object
```

{% endtab %}

{% tab title="404 Listing not found" %}

```
{
    "message": "Listing not found"
}
```

{% endtab %}
{% endtabs %}
