# Users

Users can interact with submissions in different ways.

# Check owner

This is used to determinate the owner of submission and grant privileges to edit or delete it

# Resource URL

https://humtog.com/api/api/submission-owner/:submission_slug

# Resource Method

GET

# Example Response

{
    "can": true
}

# Bookmark

This route toggles the "bookmark" action for the submission. Meaning that the first time you call it, it'll bookmark the submission; the second call for the same record will cause removing "bookmark" record.

TIP

The response is different for "bookmark" and "undo bookmark". You can use either the response's message or status code to detect whether the action has caused "bookmark" or "undo bookmark". Since the "bookmark" action causes creating a record in our database, it has the status code of 201. The "undo bookmark" isn't creating anything; thus it has the status code of 200.

# Resource URL

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

# Resource Method

POST

# Example Response

When performed a "bookmark" action:

{
    "message": "Bookmarked successfully."
}

When performed an "undo bookmark" action:

{
    "message": "Undid bookmark successfully."
}

# Like

This route toggles the "like" action for the submission. Meaning that the first time you call it, it'll like the submission; the second call for the same record will cause removing "like" record.

TIP

The response is different for "like" and "undo like". You can use either the response's message or status code to detect whether the action has caused "like" or "undo like". Since the "like" action causes creating a record in our database, it has the status code of 201. The "undo like" isn't creating anything; thus it has the status code of 200.

# Resource URL

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

# Resource Method

POST

# Example Response

When performed a "like" action:

{
    "message": "Liked successfully."
}

When performed an "undo like" action:

{
    "message": "Undid like successfully."
}

# Vote

Vote works different, it sends a vote status of 1 or -1 depending if clicked on 'up vote' or 'down vote' button respectively. If user again click same vote button it will reset vote to 0.

# Resource URL

https://humtog.com/api/submission/:submission_id/vote

# Resource Method

POST

# Params

Name Required Type Description
status Yes string It has three possible outcomes -1, 1 and 0.

# Example Response

When performed an "up vote":

{
    "message": "Down voted submission",
    "data": {
        "uservote": -1,
        'votes': 34
    }
}

In case of down vote return message will be Down voted submission. and in case of reversal Removed vote from submission.

uservote and votes are used to update current status of votes on submission as well as current user vote action.

{
    "vote": null
}

# Report

# Resource URL

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

# Resource Method

POST

# Params

Name Required Type Description
subject Yes string Must be one these values: It's spam, It doesn't follow channel's exclusive rules, It doesn't follow Humtog's general rules, It's harassing me or someone that I know, Other.
description No string Optional description which cannot exceed 5,000 characters.

# Example Response

{
    "message": "Report submitted successfully."
}

# Remove Submission Thumbnail

Must be the owner of the submission

# Resource URL

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

# Resource Method

DELETE

# Example Response

When you set submission status as newsworthy:

{
    "message": "thumbnail removed."
}