> For the complete documentation index, see [llms.txt](https://ryandw11.gitbook.io/general/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ryandw11.gitbook.io/general/ryandw11-images/rest-api.md).

# REST API

The API returns [ImageObjects ](/general/ryandw11-images/objects.md#image-object)and [UserObjects](/general/ryandw11-images/objects.md#user-object).

## Ping

<mark style="color:blue;">`GET`</mark> `https://img.ryandw11.com/api/v1/ping`

Check if the Ryandw11 Images service is online.

{% tabs %}
{% tab title="200: OK Pong" %}

```javascript
pong
```

{% endtab %}
{% endtabs %}

## Get Images

<mark style="color:blue;">`GET`</mark> `https://img.ryandw11.com/api/v1/images`

Get a list of images from Ryandw11 Images.\
***Note**: Not all images are obtained at once. A page system is used to restrict the amount of data at once. The default amount of images per page is 30, but you can obtain up to 100 at a time.*

#### Query Parameters

| Name     | Type   | Description                                     |
| -------- | ------ | ----------------------------------------------- |
| imgCount | number | The number of images to obtain. (Default 30)    |
| pge      | number | The current page for images. (Default 1)        |
| title    | string | Only get images that match the provided titles. |

{% tabs %}
{% tab title="200 This returns the following if successful:" %}

```javascript
{
    "error": false,
    "hasPreviousPage": boolean,
    "hasNextPage": boolean,
    "pageNumber": number,
    "totalImageCount": number,
    "images": [ImageObject]
}
```

{% endtab %}

{% tab title="400 An error was discovered in your request." %}

```javascript
{
    "error": true, 
    "error_message": String, 
    "images": []
}
```

{% endtab %}
{% endtabs %}

## User Images

<mark style="color:blue;">`GET`</mark> `https://img.ryandw11.com/api/v1/images/:user`

Get the images for a certain user. (Note: Unlisted images cannot be obtained).

#### Path Parameters

| Name | Type   | Description                                |
| ---- | ------ | ------------------------------------------ |
| user | string | The UUID of the user to obtain images for. |

#### Query Parameters

| Name     | Type   | Description                                     |
| -------- | ------ | ----------------------------------------------- |
| imgCount | string | The number of images to obtain. (Default 30)    |
| title    | string | Only get images that match the provided titles. |
| pge      | number | The page number of the page of images.          |

{% tabs %}
{% tab title="200 Returns the following if successful:" %}

```javascript
{
    "error": false,
    "uuid": String,
    "hasPreviousPage": boolean,
    "hasNextPage": boolean,
    "pageNumber": number,
    "totalImageCount": number,
    "images": [ImageObject]
}
```

{% endtab %}

{% tab title="400 An error was discovered in your request." %}

```javascript
{
    "error": true, 
    "error_message": String, 
    "images": []
}
```

{% endtab %}
{% endtabs %}

## Get Users

<mark style="color:blue;">`GET`</mark> `https://img.ryandw11.com/api/v1/users`

Get a list of users. Like the images, this is a paged list.\
***Note:** Admin users will not be returned.*

#### Query Parameters

| Name      | Type   | Description                                           |
| --------- | ------ | ----------------------------------------------------- |
| userCount | number | The number of users to display per page. (Default 30) |
| username  | string | Display users that match the username requirement.    |
| pge       | number | The page number for the users.                        |

{% tabs %}
{% tab title="200 Returns the following if successful:" %}

```javascript
{
    "error": false,
    "hasPreviousPage": boolean,
    "hasNextPage": boolean,
    "pageNumber": number,
    "totalUserCount": number,
    "users": [UserObject]
}
```

{% endtab %}

{% tab title="400 An error was discovered in your request." %}

```javascript
{
    "error": true, 
    "error_message": String, 
    "users": []
}
```

{% endtab %}
{% endtabs %}
