Search

Coub web API allows you to search among coubs and channels. The API provides several methods to perform search among all the data, among channels or coub data, among coub tags.

General search

This method makes a search among all available data.

Resource endpoint:

GET /api/v2/search

Request parameters:

  • q (string) — the search phrase;
  • order_by (string) — sets an order of the search result, accepts one of the following values: likes_count, views_count , newest, oldest, newest_popular;
  • page (integer) — the number of the page containing results (by default is set to 1).

Request example:

GET /api/v2/search?q=best coub ever&order_by=newest_popular

Response parameters:

The Coub server responses with a JSON that contains following data:

  • channels (array) — the array of channel big JSONs that relate to the search query;
  • coubs (array) — array of coub big JSONs that relate to the search query;
  • page (integer) — the number of the required page;
  • total_pages (integer) — the number of all pages.

Response example

{
  "channels": [channel big JSONs],
  "coubs": [coub big JSONs],
  "page": 1,
  "total_pages": 14,
  "per_page": 10
}

Search among channels

This method makes a search among channels data.

Resource endpoint:

GET /api/v2/search/channels

Request parameters:

  • q (string) — the search phrase;
  • order_by (string) — sets an order of the search result, accepts one of the following values: newest, followers_count;
  • page (integer) — the number of the page containing results (by default is set to 1).

Request example:

GET /api/v2/search/channels?q=best coub ever&order_by=newest

Response parameters:

The Coub server responses with a JSON, contains following data:

  • channels (array) — the array of channel big JSONs that relate to the search query;
  • page (integer) — the number of the required page;
  • total_pages (integer) — the number of all pages;
  • per_page (integer) — the number of entities per one page.

Response example:

{
  "channels": [channel big JSONs],
  "page": 1,
  "total_pages": 14,
  "per_page": 10
}

Search among coubs

This method makes a search among coubs data.

Resource endpoint:

GET /api/v2/search/coubs

Request parameters:

  • q (string) — the search phrase;
  • order_by (string) — sets an order of the search result, accepts one of the following values: likes_count, views_count , newest,oldest, newest_popular.
  • page (integer) — the number of the page containing results (by default is set to 1).

Request example:

GET /api/v2/search/coubs?q=best coub ever&order_by=likes_count

Response parameters:

The Coub server responses with a JSON, contains following data:

  • coubs (array) — the array of coub big JSONs that relate to the search query;
  • page (integer) — the number of the required page;
  • total_pages (integer) — the number of all pages.

Response example:

{
  "coubs": [coub big JSONs],
  "page": 1,
  "total_pages": 14,
  "per_page": 10
}

Search among tags

This method makes a search among tags.

Resource endpoint:

GET /api/v2/tags/search

Request parameters:

  • title (string) — the title of the tag.

Request example:

GET /api/v2/tags/search?title=myTagName

Response parameters:

The Coub server responses with an array of JSONs that contain following fields:

  • id (integer) — the id of the coub with the required tag;
  • title (string) — the title of the coub with the required tag;
  • value (string) — the title of the tag with escaped characters.

Response example:

[
  {
    id: 1201,
    title: "myTagName",
    value: "myTagName"
  },
  {
    id: 25333,
    title: "myTagName",
    value: "myTagName"
  }
]