# CRUD Methods

Here are all crud methods for channels.

# Get Channel

# Resource URL

https://humtog.com/api/channels/:channel_id

Via param name

https://humtog.com/api/channels

# Resource Method

GET

# Params

Used in second URL

Name Required Type Description
name Yes text Name of the channel.

# Example Response

{
    "data": {
        "id": 1,
        "name": "channelName",
        "description": "Mollitia dolorum quia necessitatibus quia. Odio velit fugiat quisquam ut. Culpa aspernatur omnis officiis dignissimos.",
        "nsfw": false,
        "cover_color": "Blue",
        "avatar": "/imgs/channel-avatar.png",
        "subscribers_count": 0,
        "comments_count": 0,
        "submissions_count": 1,
        "created_at": "2018-05-26 15:14:06"
    }
}

# Get Channels Submissions

# Resource URL

https://humtog.com/api/channels/:channel_id

Via param channel_name

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

# Resource Method

GET

# Params

Used in second URL

Name Required Type Description
channel_name Yes text Name of the channel.

# Example Response

{
    "data": [
        {
            "id": 1,
            "slug": "submission-slug",
            "channel_id": 1,
            "channel_name": "channelName",
            "channel_title": "channelTitle",
            "location": {
                ...
            },
            "user_id": 2,
            "title": "submissionTitle",
            "upvote": {
                ...
            },...
        },
        ...
    ],
    "links": {
        "first": "https://humtog.com/api/channels/submissions?page=1",
        "last": null,
        "prev": null,
        "next": "https://humtog.com/api/channels/submissions?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://humtog.com/api/channels/submissions",
        "per_page": 15,
        "to": 15
    }
}

# Get All Channels

# Resource URL

https://humtog.com/api/get-all-channels

# Resource Method

GET

# Params

Name Required Type Description
type No text Can be category(channel) or location, not required. Only used when creating post form category or location.
name Only if type is preset text Name of channel or slug of location.

# Example Response

{
    "error": false,
    "data": [
        {
            "id": 1,
            "name": "cagetogyName",
            "title": "cagetogyTitle",
            "language": "en",
            "description": "description",
            "nsfw": 0,
            "color": "Blue",
            "avatar": "/imgs/channel-avatar.png",
            "public": 0,
            "subscribers": 1,
            "created_at": "2020-04-29 13:34:53",
            "location_id": 1,
            "tagline": "tagline",
            "rules": "rules",
            "type": null,
            "location": {
                ...
            }
        },
        ...
    ]
}

# Create Channel

# Resource URL

https://humtog.com/api/channels

# Resource Method

POST

# Params

Name Required Type Description
name Yes string The name of the channel. Note that it cannot be modified later. Up to 50 characters.
description Yes string Describes the creating channel in 10-400 characters. It is used by users trying to find your channel.
location Yes integer To what location this channel belongs

# Example Response

{
    "data": {
        "id": 1,
        "name": "myNewChannel",
        "description": "describing my cool channel",
        "nsfw": false,
        "cover_color": "Blue",
        "avatar": "/imgs/channel-avatar.png",
        "subscribers_count": 0,
        "comments_count": 0,
        "submissions_count": 1,
        "created_at": "2018-05-26 15:33:33"
    }
}

# Edit Channel

Only channel's administrators are permitted to edit the channel. That means moderators cannot perform such operation.

# Resource URL

https://humtog.com/api/channels/:channel_id

# Resource Method

PATCH

# Params

Name Required Type Description
description Yes string Describes the creating channel in 10-400 characters. It is used by users trying to find your channel.
cover_color Yes string The color used as the background of the channel's cover. Must be one of these values: Dark Blue,Blue,Red,Dark,Pink,Dark Green,Bright Green,Purple,Gray,Orange
nsfw Yes boolean Does the channel contain mostly NSFW (not safe for work) content? false or true, default is false
public Yes boolean Is the channel visible to public? false or true, default is true

# Example Response

{
    "message": "Channel has been updated successfully."
}

# Upload Channel Avatar

Only channel’s administrators have permission to perform this request. That means even channel's moderators cannot perform such operation.

# Resource URL

https://humtog.com/api/channels/:channel_id/avatar

# Resource Method

POST

# Params

Name Required Type Description
photo Yes file The photo you're trying to upload as the new avatar for the channel. It must have a minimum of 250x250 pixels with a ratio of 1/1. (such as a square or circle)

# Example Response

Response contains the URL to the new uploaded avatar photo in png format:

https://cdn.humtog.com/channels/avatars/1527423363K2Al4Ss3DDN4YpHN.png