Timelines

You can get any user or channel feed via this API.

All methods for getting feeds have same optional request parameters:

  • page (integer) — the number of needed timeline pages (by default is set to 1);
  • per_page (integer) — the number of entities in the timeline (by default is set to 10);
  • order_by (string) — the sorting parameter, accepts different values which depend on method;
  • page_of (integer) — requires a coub's id and returns the timeline page that contains this id.

The Coub server responses to a request with a JSON that contains following fields:

  • page (integer) — the number of the required timeline page;
  • total_pages (integer) — the number of all pages;
  • per_page (integer) — the number of entities per one page;
  • coubs (array) — array of coub big JSONs, that listed in the required timeline page, with the additional field:
    • position_on_page (integer) — the coub's position on the required page.

Response example:

{
    page: 1,
    total_pages: 1,
    per_page: 10,
    coubs: [
        {
            Coub big JSON,
            suggestions: [],
            position_on_page: 1
        }
    ]
}

User timeline

The timeline displays user's coubs and coubs from channels he or she follow, in a chronological order.

Resource endpoint:

GET /api/v2/timeline

This endpoint ignores order_by parameter.

Request example:

GET /api/v2/timeline?page=1&per_page=10

Channel timeline

Returns coubs of the specified channel in a chronological order.

Resource endpoint:

GET /api/v2/timeline/channel/:channel_id
  • channel_id (integer) — the identifier of the channel.

This endpoint accepts following order_by values: likes_count, views_count, newest_popular.

Request example:

GET /api/v2/timeline/channel/55?page=1&per_page=10?order_by=views_count

Tag feed

Displays all coubs tagged with the required tag.

Resource endpoint:

GET /api/v2/timeline/tag/:tag_name
  • tag_name (string) — the name of the required tag.

This endpoint accepts following order_by values: likes_count, views_count, newest_popular, oldest.

Request example:

GET /api/v2/timeline/tag/1341?page=1&per_page=10?order_by=oldest

Timeline of the Hot section

Returns coubs which are most popular by now.

Resource endpoint:

GET /api/v2/timeline/hot

This endpoint accepts following order_by values: likes_count, views_count, newest_popular, oldest.

Request example:

GET /api/v2/timeline/hot?page=1&per_page=10&order_by=oldest

Timeline of the Explore section categories

Returns coubs which are presented in the Explore section.

Resource endpoint:

GET api/v2/timeline/explore/:category_id

This methods returns a timelines of Explore categories; an accepted categories identifiers are following: random, newest, coub_of_the_day

This endpoint ignores order_by parameter.

Request example:

GET api/v2/timeline/explore/coub_of_the_day?page=1&per_page=10

Timeline of the Likes section

Returns coubs that you liked.

Resource endpoint:

GET /api/v2/timeline/likes

This endpoint ignores order_by parameter.

Request example:

GET /api/v2/timeline/likes/?page=1&per_page=10