# CRUD Methods

Here are all crud methods for submissions

# Get Submission

# Resource URL

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

# Resource Method

GET

# Params

Name Required Type Default Description
with_channel No boolean false Includes data of the submitted channel. Accept 1, 0, true, false

# Example Response

{
    "data": {
        "id": 3,
        "slug": "laravel-scheduler-adds-support-for-running-hourly-tasks-on-a-certain-minute",
        "channel_id": 3,
        "channel_name": "laravel",
        "user_id": 1,
        "title": "Laravel Scheduler Adds Support for Running Hourly Tasks on a Certain Minute",
        "type": "link",
        "nsfw": false,
        "content": {
            "img": "https://cdn.humtog.com/submissions/link/1483997753j9RqCml.jpg",
            "url": "https://laravel-news.com/scheduler-hourlyat",
            "type": "link",
            "embed": "",
            "title": "Laravel Scheduler Adds Support for Running Hourly Tasks on a Certain Minute",
            "thumbnail": "https://cdn.humtog.com/submissions/link/thumbs/1483997753dXwOHsk.jpg",
            "description": "Laravel Scheduler now includes a new method hourlyAt that will allow you to define the minute within the hour that a task should run.",
            "providerName": "Laravel News",
            "publishedTime": "2017-01-06T20:34:00-05:00"
        },
        "rate": 229.2,
        "likes_count": 3,
        "comments_count": 0,
        "approved_at": null,
        "disapproved_at": null,
        "created_at": "2017-01-09 19:05:54",
        "url": "https://laravel-news.com/scheduler-hourlyat",
        "domain": "laravel-news.com",
        "author": {
            "id": 1,
            "username": "sully",
            "name": "Sully Fischer",
            "bio": "Just a rock n roll rebel who also happens to like developing web applications",
            "avatar": "https://cdn.humtog.com/users/avatars/1505414772nkM1CzJ.png",
            "verified_email": true,
            "cover_color": "Dark Blue",
            "created_at": "2017-01-09 17:34:14",
            "info": {
                "location": "Earth Planet",
                "twitter": "sullyfischer",
                "website": "https://humtog.com"
            }
        }
    }
}

# Create Submission

# Resource URL

https://humtog.com/api/submissions

# Resource Method

POST

# Params

Name Required Type Description
channel_name Yes string The name of the channel you're trying to submit the post to.
type Yes string The type of the submission. Accepted values are: link, img, text.
title Yes string Title of the post. Must be between 7-150 characters.
description Yes if type is text text html encoded text of the post
url Yes if type is link url A valid URL you're trying to submit as a link post. Can't be one of blocked domains.
photos_id Yes if type is img array An array filled with IDs of the uploaded photos. If it's filled with more than a single ID, it'll create an album. You don't need to do further action for it. Max 20 items
submissionType Yes string Type of submission can be serious or relaxed

# Example Response

{
    "title": "Some cool title for my post",
    "slug": "some-cool-title-for-my-post-5",
    "url": "/p/some-cool-title-for-my-post-5",
    "domain": null,
    "type": "text",
    "type_of_submission": "serious",
    "channel_name": "General",
    "channel_id": 1,
    "nsfw": 0,
    "rate": 2589.8016,
    "user_id": 1,
    "data": {
        "title": "Some cool title for my post",
        "description": "<p>some cool content that supports markdown as well.</p>"
    },
    "original": false,
    "newsworthy": false,
    "newsworthy_user_id": null,
    "timeRelevance": null,
    "updated_at": "2020-05-23 12:38:31",
    "created_at": "2020-05-23 12:38:31",
    "id": 22
}

# Edit Submission

At the moment, Humtog only allows the edit action for text typed submissions content.

# Resource URL

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

# Resource Method

PATCH

# Params

Name Required Type Description
description Yes text String content of the submission. null is also accepted.

# Example Response

{
    "message": "Text Submission has been updated."
}

# Delete Submission

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

# Resource URL

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

# Resource Method

DELETE

# Example Response

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