# Artists

## Create an artist

<mark style="color:green;">`POST`</mark> `https://api.lolwallpapers.net/beta/artists`

#### Request Body

| Name  | Type   | Description                                                                                    |
| ----- | ------ | ---------------------------------------------------------------------------------------------- |
| name  | string | The name of the artist.                                                                        |
| links | array  | An array of valid URLs that lead to the artist's pages (deviantart, artstation, twitter, etc.) |

{% tabs %}
{% tab title="201 Artist successfully created." %}

```
{
    "status": "success",
    "data": {
        "id": "BA7R"
    }
}
```

{% endtab %}

{% tab title="400 Validation failed." %}

```
{
    "status": "fail",
    "data": {
        "name": [
            "This value should not be blank."
        ]
    }
}
```

{% endtab %}

{% tab title="403 The user needs to confirm his email address." %}

```
{
    "status": "fail",
    "data": "You need to confirm your email address first."
}
```

{% endtab %}
{% endtabs %}

## Get a list of artists

<mark style="color:blue;">`GET`</mark> `https://api.lolwallpapers.net/beta/artists`

#### Query Parameters

| Name   | Type   | Description                                                                                                     |
| ------ | ------ | --------------------------------------------------------------------------------------------------------------- |
| search | string | Search through all artists names.                                                                               |
| sort   | string | <p>Sort by:<br>- name<br>- wallpapers<br>- views<br>- downloads<br>- created\_at (default)<br>- updated\_at</p> |
| order  | string | <p>Order by:<br>- asc<br>- desc (default)</p>                                                                   |
| limit  | number | <p>The amount of artists to display per page.<br>Default: 20<br>Minimum: 1<br>Maximum: 50</p>                   |
| page   | number | <p>The page to display.<br>Default: 1</p>                                                                       |

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

```
{
    "status": "success",
    "data": [
        {
            "id": "BA7R",
            "name": "John Doe",
            "links": [
                "https://www.deviantart.com/johndoe"
            ],
            "wallpapers": 0,
            "created_by": {
                "id": "Q6lB",
                "display_name": "John Doe"
            },
            "created_at": 1596650119,
            "updated_at": 1596650119
        },
    ]
}
```

{% endtab %}

{% tab title="400 Validation failed." %}

```
{
    "status": "fail",
    "data": {
        "order": [
            "The value you selected is not a valid choice."
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Get an artist

<mark style="color:blue;">`GET`</mark> `https://api.lolwallpapers.net/beta/artists/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | The artist ID. |

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

```
{
    "status": "success",
    "data": {
        "id": "BA7R",
        "name": "John Doe",
        "links": [
            "https://www.deviantart.com/johndoe"
        ],
        "wallpapers": 0,
        "created_by": {
            "id": "Q6lB",
            "display_name": "John Doe"
        },
        "created_at": 1596650119,
        "updated_at": 1596650119
    }
}
```

{% endtab %}

{% tab title="404 Artist not found." %}

```
{
    "status": "success",
    "data": "Not Found."
}
```

{% endtab %}
{% endtabs %}

## Edit an artist

<mark style="color:purple;">`PATCH`</mark> `https://api.lolwallpapers.net/beta/artists/:id`

#### Path Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
|      | string | The artists ID. |

#### Request Body

| Name  | Type   | Description                                                                                    |
| ----- | ------ | ---------------------------------------------------------------------------------------------- |
| name  | string | The name of the artist.                                                                        |
| links | string | An array of valid URLs that lead to the artist's pages (deviantart, artstation, twitter, etc.) |

{% tabs %}
{% tab title="204 Artist successfully updated." %}

```
```

{% endtab %}

{% tab title="400 Validation failed." %}

```
{
    "status": "fail",
    "data": {
        "links[0]": [
            "This value is not a valid URL."
        ]
    }
}
```

{% endtab %}

{% tab title="404 Artist not found." %}

```
{
    "status": "success",
    "data": "Not Found."
}
```

{% endtab %}
{% endtabs %}
