# CRUD Methods

Here are all crud methods for comments

# Get Comment

# Resource URL

https://humtog.com/api/comments/:comment_id

# Resource Method

GET

# Params

Name Required Type Default Description
with_children No boolean false Include children comments within the response (in case there is any of course). Accept 1, 0, true, false

# Example Response

{
    "data": {
        "id": 1,
        "submission_id": "1",
        "user_id": "2",
        "channel_id": "1",
        "parent_id": null,
        "nested_level": "0",
        "rate": "1192.08",
        "likes_count": "1",
        "content": {
            "text": "Asperiores eius reiciendis omnis. Et architecto vero atque explicabo dolores aut. Dolor qui aut qui ad similique voluptatem."
        },
        "approved_at": null,
        "disapproved_at": null,
        "created_at": "2018-05-26 13:07:19",
        "edited_at": null,
        "author": {
            "id": 2,
            "username": "tess82",
            "name": "Hershel Ullrich",
            "bio": null,
            "avatar": "/imgs/default-avatar.png",
            "verified_email": true,
            "cover_color": "Dark",
            "created_at": "2018-05-26 13:07:19",
            "info": {
                "location": "Maldives",
                "twitter": null,
                "website": null
            }
        }
    }
}

# Create Comment

# Resource URL

https://humtog.com/api/submissions/:submission_id/comments

# Resource Method

POST

# Params

Name Required Type Default Description
body Yes string Content of comment. Can't exceed 5000 characters.
parent_id No integer null The id of the parent comment. Used when trying to send a reply to another comment.
type Yes string relaxed Determinate comment type, can be serious or relaxed.

# Example Response

{
    "data": {
        "id": 1,
        "submission_id": 1,
        "user_id": 1,
        "channel_id": "1",
        "parent_id": null,
        "nested_level": 0,
        "rate": 1192.105111111111,
        "likes_count": 1,
        "content": {
            "text": "some cool comment which BTW supports **markdown**"
        },
        "approved_at": null,
        "disapproved_at": null,
        "created_at": "2018-05-26 13:26:09",
        "edited_at": null,
        "author": {
            "id": 1,
            "username": "kira92",
            "name": "Adolphus Hartmann",
            "bio": null,
            "avatar": null,
            "email": "okuneva.emmanuelle@example.net",
            "verified_email": true,
            "cover_color": null,
            "created_at": "2018-05-26 13:26:09",
            "info": {
                "location": "Czech Republic",
                "twitter": null,
                "website": null
            }
        }
    }
}

# Edit Comment

# Resource URL

https://humtog.com/api/comments/:comment_id

# Resource Method

PATCH

# Params

Name Required Type Description
text Yes string String content of the comment. Can’t exceed 5,000 characters.

# Example Response

{
    "message": "Comment edited successfully."
}

# Delete Comment

Needless to say, author of the comment is the only user who can delete it. Channel moderators can disapprove the comment, which is slightly different than deleting it.

# Resource URL

https://humtog.com/api/comments/:comment_id

# Resource Method

DELETE

# Example Response

{
    "message": "Comment deleted successfully."
}