Friends

Using friends endpoint you can obtain data about channels that your social network friends have.

Caching data from a social network

This method instructs Coub server to get data about your friends from social networks and store it in the server's cache.

Resource endpoint:

GET /api/v2/friends/find

Request parameters:

  • provider (string) — the required social network, can be one of the following: facebook, twitter, vkontakte, google; optional parameter, if it is not specified the server will cache data from all these social networks.

Request example:

GET /api/v2/friends/find?provider=google

Response format:

  • status (string) — the status of the request processing, can be either ok or fail;
  • friends (JSON) — the JSON that contains two fields:
    • registered (integer) — the number of friends that have a Coub channel or channels;
    • unregistered (integer) — the number of friends that have no Coub channels.

Response example

{
    "status": "ok", 
    "friends": 
    {
        "registered": "100",
        "unregistered": "200"
    }
}

Geting data about you friends channels

This method lets you retrieve data about the channels that your friends have from the Coub server's cache.

Note, that to get the latest up-to-date data you need to cache it first using /api/v2/friends/find endpoint. If there is no data in the cache, server will return zero found entries.

Resource endpoint:

GET /api/v2/friends

Request parameters:

  • page (integer) — the number of the page containing results (by default is set to 1);
  • per_page (integer) — the number of notifications per one page, optional parameter;
  • provider (string) — the required social network, can be one of the following: facebook, twitter, vkontakte, google; optional parameter, if it is not specified the server will cache data from all these social networks.

Request example:

GET /api/v2/friends?per_page=20&page=2&provider=facebook

Response format:

  • page (integer) — the number of the required page;
  • total_pages (integer) — the number of all pages;
  • per_page (integer) — the number of notifications per one page, optional parameter;
  • friends (array) — the array of channel small JSONs that your friends have.

Response example

{
    "page": "1",
    "total_pages": "20",
    "total_friends": "200",
    "per_page": "10",
    "friends": [channel small JSONs]
}

Getting list of recommended channels

This method lets you retrieve channels that are chosen among your friends channels by Coub recommendation algorithms.

Resource endpoint:

GET /api/v2/friends/recommended

Request parameters:

  • page (integer) — the number of the page containing results (by default is set to 1);
  • per_page (integer) — the number of notifications per one page, optional parameter;
  • q (string) — the search phrase that limits the recommendations according to specific words in the channel title, optional parameter.

Request example:

GET /api/v2/friends/recommended?page=2&q=some phrase

Response format:

  • page (integer) — the number of the required page;
  • total_pages (integer) — the number of all pages;
  • per_page (integer) — the number of notifications per one page, optional parameter;
  • friends (array) — the array of channel small JSONs that your friends have.

Response example

{
    "page": "1",
    "total_pages": "20",
    "total_friends": "200",
    "per_page": "10",
    "friends": [channel small JSONs]
}