# Meme

The Meme object is returned when requesting 1 or multiple memes. An example object is as follows.

| Field     | Type      | Description                                               |
| --------- | --------- | --------------------------------------------------------- |
| disabled  | boolean   | is the meme disabled?                                     |
| memeid    | string    | the meme's id                                             |
| caption   | string    | the meme's caption                                        |
| author    | User      | a user object of the author                               |
| rating    | hash      | hash of the rating, with the average and total ratings    |
| url       | string    | the url of the image of the meme                          |
| permalink | string    | the url of the meme on memerator.me                       |
| timestamp | timestamp | when the meme was submitted                               |
| time\_ago | string    | what appears on the website how long ago it was submitted |

```javascript
{
    "disabled": false,
    "memeid": "aaaaaaa",
    "caption": "***__AAAAAAAA__***",
    "author": {
        "username": "Chew",
        "bio": "#1 most depressed memerator user. pronouns: she/her",
        "id": 476488167042580481,
        "stats": {
            "memes": 171,
            "followers": 26,
            "following": 20
        },
        "perks": {
            "verified": true,
            "staff": true,
            "translator": false,
            "pro": true
        },
        "permalink": "https://memerator.me/profile/476488167042580481",
        "joined": "2018-10-11T15:37:03.000Z"
    },
    "rating": {
        "average": 3.75,
        "total": 4
    },
    "url": "https://cdn.memerator.me/K7bLRy9.jpg",
    "permalink": "https://memerator.me/meme/aaaaaaa",
    "timestamp": "2019-02-15T13:29:01.000Z",
    "time_ago": "11 months"
}
```

## Get a Meme

<mark style="color:blue;">`GET`</mark> `https://api.memerator.me/v1/meme/:id`

This request gets a meme by its ID.

#### Path Parameters

| Name    | Type   | Description                 |
| ------- | ------ | --------------------------- |
| Meme ID | string | The ID of the meme you want |

{% tabs %}
{% tab title="200" %}
Response of a valid meme.

```json
{
    "disabled": false,
    "memeid": "aaaaaaa",
    "caption": "***__AAAAAAAA__***",
    "author": {
        "username": "Chew",
        "bio": "#1 most depressed memerator user. pronouns: she/her",
        "id": 476488167042580481,
        "stats": {
            "memes": 171,
            "followers": 26,
            "following": 20
        },
        "perks": {
            "verified": true,
            "staff": true,
            "translator": false,
            "pro": true
        },
        "permalink": "https://memerator.me/profile/476488167042580481",
        "joined": "2018-10-11T15:37:03.000Z"
    },
    "rating": {
        "average": 3.75,
        "total": 4
    },
    "url": "https://cdn.memerator.me/K7bLRy9.jpg",
    "permalink": "https://memerator.me/meme/aaaaaaa",
    "timestamp": "2019-02-15T13:29:01.000Z",
    "time_ago": "11 months"
}
```

{% endtab %}

{% tab title="401" %}
Response of an invalid auth key.

```javascript
{
    "error": "Auth not valid"
}
```

{% endtab %}

{% tab title="404" %}
Response of a meme that doesn't exist (or is disabled, and you aren't the owner)

```javascript
{
    "error": "meme does not exist"
}
```

{% endtab %}
{% endtabs %}

## Get a Random Meme

<mark style="color:blue;">`GET`</mark> `https://api.memerator.me/v1/meme/random`

Gets a random meme. Note: Not completely random?

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

```
[a meme object]
```

{% endtab %}

{% tab title="401 Response when using an invalid API key" %}

```javascript
{
    "error": "Auth not valid"
}
```

{% endtab %}
{% endtabs %}

## Set Meme Caption

<mark style="color:orange;">`PUT`</mark> `https://api.memerator.me/v1/meme/:id/caption`

Change the caption of a meme you own.

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| :id  | string | ID of the meme |

#### Query Parameters

| Name    | Type   | Description                       |
| ------- | ------ | --------------------------------- |
| caption | string | The caption you want to set it to |

{% tabs %}
{% tab title="200 A successful caption change response" %}

```javascript
{
    "success": true,
    "caption": "uwu owo nyaa",
    "oldcaption": "you got got guten prankened"
}
```

{% endtab %}

{% tab title="400 When a known error occurs, you'll get this. It can differ, so we put a blank error in. Error will always contain something." %}

```javascript
{
    "error": ""
}
```

{% endtab %}

{% tab title="401 response when using an invalid api key" %}

```javascript
{
    "error": "Auth not valid"
}
```

{% endtab %}

{% tab title="403 Returned if you try to change the caption of a meme you don't own" %}

```javascript
{ "error": "you don't own this meme" }
```

{% endtab %}

{% tab title="404 Raised if you try to edit a meme that doesn't exist" %}

```javascript
{ "error": 'meme does not exist' }
```

{% endtab %}

{% tab title="500 When an unknown error occurs, you'll get this." %}

```javascript
{ "error": 'Unknown Error Changing Caption' }
```

{% endtab %}
{% endtabs %}

## Get Meme Comments

<mark style="color:blue;">`GET`</mark> `https://api.memerator.me/v1/meme/:id/comments`

This method returns an array of comments for a specified meme and their author.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| :id  | string | meme id     |

{% tabs %}
{% tab title="200 An array of comments. In each comment object there is ID, author (User object), the content, the associated Meme, the timestamp, and the creation in epoch seconds." %}

```javascript
[
    {
        "id": 5,
        "author": {
            "username": "Chew",
            "bio": "#1 most depressed Memerator user. pronouns: she/her 🏳️‍⚧️",
            "id": 476488167042580481,
            "stats": {
                "memes": 382,
                "followers": 28,
                "following": 24
            },
            "perks": {
                "verified": true,
                "staff": true,
                "translator": false,
                "pro": true
            },
            "permalink": "https://memerator.me/profile/476488167042580481",
            "joined": "2018-10-11T15:37:03.000Z",
            "joined_epoch_seconds": 1539272223
        },
        "content": "aaaaaaaaaaaaaaaaaaaaaa",
        "meme": {
            "disabled": false,
            "memeid": "aaaaaaa",
            "caption": "***__AAAAAAAA__***",
            "author": {
                "username": "Chew",
                "bio": "#1 most depressed Memerator user. pronouns: she/her 🏳️‍⚧️",
                "id": 476488167042580481,
                "stats": {
                    "memes": 382,
                    "followers": 28,
                    "following": 24
                },
                "perks": {
                    "verified": true,
                    "staff": true,
                    "translator": false,
                    "pro": true
                },
                "permalink": "https://memerator.me/profile/476488167042580481",
                "joined": "2018-10-11T15:37:03.000Z",
                "joined_epoch_seconds": 1539272223
            },
            "rating": {
                "average": 4.0,
                "total": 5
            },
            "age": 1,
            "url": "https://cdn.memerator.me/K7bLRy9.jpg",
            "permalink": "https://memerator.me/meme/aaaaaaa",
            "timestamp": "2019-02-15T13:29:01.000Z",
            "timestamp_epoch_seconds": 1550237341,
            "time_ago": "over 1 year"
        },
        "timestamp": "2020-02-02T15:11:31.000Z",
        "timestamp_epoch_seconds": 1580656291
    }
]
```

{% endtab %}
{% endtabs %}

## Disable a Meme

<mark style="color:orange;">`PUT`</mark> `https://api.memerator.me/v1/meme/:id/disable`

Disables a meme by ID. Meme author only!

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| :id  | string | Meme ID     |

{% tabs %}
{% tab title="200 If you did it right!" %}

```
{ "success": true }
```

{% endtab %}

{% tab title="400 If the meme is already disabled" %}

```
{ "error": "this meme is already disabled" }
```

{% endtab %}

{% tab title="401 If your key is invalid or can't access the resource" %}

```
{ "error": "Auth not valid" }
```

{% endtab %}

{% tab title="403 If you don't own the meme" %}

```
{ "error": "you don't own this meme" }
```

{% endtab %}

{% tab title="404 If the meme doesn't exist (or is disabled and you aren't the owner)" %}

```
{ "error": "meme does not exist" }
```

{% endtab %}
{% endtabs %}

## Enable a meme

<mark style="color:orange;">`PUT`</mark> `https://api.memerator.me/v1/meme/:id/enable`

Exact same as disable, but for enabling

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| :id  | string | The Meme ID |

{% tabs %}
{% tab title="200 If you did it right!" %}

```
{ "success": true }
```

{% endtab %}

{% tab title="400 If the meme is already enabled" %}

```
{ "error": "this meme is already enabled" }
```

{% endtab %}

{% tab title="401 If the API key is invalid or can't access the resource" %}

```
{ "error": "Auth not valid" }
```

{% endtab %}

{% tab title="403 If you don't own the meme" %}

```
{ "error": "you don't own this meme" }
```

{% endtab %}

{% tab title="404 If the meme doesn't exist or it's disabled and you aren't the owner." %}

```
{ "error": "meme does not exist" }
```

{% endtab %}
{% endtabs %}

## Get your Rating

<mark style="color:blue;">`GET`</mark> `https://api.memerator.me/v1/meme/:id/rating`

Gets your rating on a meme.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| :id  | string | the meme id |

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

```
{ "rating": 5 }
```

{% endtab %}

{% tab title="401 If your key isn't valid or it's not allowed to access "Ratings"" %}

```
{ "error": 'Auth not valid' }
```

{% endtab %}

{% tab title="404 If the meme doesn't exist or it's disabled and you aren't the owner." %}

```
{ "error": 'meme does not exist' }
```

{% endtab %}
{% endtabs %}

## Get all Ratings

<mark style="color:blue;">`GET`</mark> `https://api.memerator.me/v1/meme/:id/ratings`

Gets all ratings for a meme. Pro only! Requires "Ratings" key permission.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| :id  | string | Meme ID.    |

{% tabs %}
{% tab title="200 A JSONArray of objects. Each Object contains a hash mapping of user to User object, rating to the rating, and the timestamp of the rating." %}

```javascript
[
    {
        "user": {
            "username": "treye_2019",
            "bio": "",
            "id": 296476360602419211,
            "stats": {
                "memes": 1,
                "followers": 0,
                "following": 0
            },
            "perks": {
                "verified": false,
                "staff": false,
                "translator": false,
                "pro": false
            },
            "permalink": "https://memerator.me/profile/296476360602419211",
            "joined": "2019-03-02T00:43:26.000Z",
            "joined_epoch_seconds": 1551487406
        },
        "rating": 1,
        "timestamp": "2019-05-20T13:04:33.000Z"
    },
    {
        "user": {
            "username": "Chew",
            "bio": "#1 most depressed Memerator user. pronouns: she/her 🏳️‍⚧️",
            "id": 476488167042580481,
            "stats": {
                "memes": 382,
                "followers": 28,
                "following": 24
            },
            "perks": {
                "verified": true,
                "staff": true,
                "translator": false,
                "pro": true
            },
            "permalink": "https://memerator.me/profile/476488167042580481",
            "joined": "2018-10-11T15:37:03.000Z",
            "joined_epoch_seconds": 1539272223
        },
        "rating": 5,
        "timestamp": "2019-05-20T13:04:33.000Z"
    },
    {
        "user": {
            "username": "Loyal_2019",
            "bio": null,
            "id": 181249274699448320,
            "stats": {
                "memes": 0,
                "followers": 0,
                "following": 0
            },
            "perks": {
                "verified": false,
                "staff": false,
                "translator": false,
                "pro": false
            },
            "permalink": "https://memerator.me/profile/181249274699448320",
            "joined": "2019-03-31T21:35:12.000Z",
            "joined_epoch_seconds": 1554068112
        },
        "rating": 4,
        "timestamp": "2019-05-20T13:04:33.000Z"
    },
    {
        "user": {
            "username": "ur_mom",
            "bio": "is gay",
            "id": 783885855388066361,
            "stats": {
                "memes": 239,
                "followers": 8,
                "following": 4
            },
            "perks": {
                "verified": true,
                "staff": false,
                "translator": false,
                "pro": false
            },
            "permalink": "https://memerator.me/profile/783885855388066361",
            "joined": "2019-10-24T20:37:28.000Z",
            "joined_epoch_seconds": 1571949448
        },
        "rating": 5,
        "timestamp": "2019-11-06T00:28:07.000Z"
    },
    {
        "user": {
            "username": "taketheshake",
            "bio": "I wish I was awesome as chew, but she's almost equivalent to comp sci meme Jesus, so maybe not.",
            "id": 338784252382412800,
            "stats": {
                "memes": 3,
                "followers": 5,
                "following": 1
            },
            "perks": {
                "verified": true,
                "staff": true,
                "translator": false,
                "pro": true
            },
            "permalink": "https://memerator.me/profile/338784252382412800",
            "joined": "2019-04-17T13:27:02.000Z",
            "joined_epoch_seconds": 1555507622
        },
        "rating": 5,
        "timestamp": "2020-02-28T14:39:58.000Z"
    }
]
```

{% endtab %}
{% endtabs %}
