Version: 1.0.0

Follows

A follow is the action of subscribing to an element, it can be a User or a Page. Once one of this entity is followed, related activities will appear in the user Stream.


Follow an entity

To follow an entity you have to make a HTTP POST request with parameters in JSON form. There are some required parameters for this operation:

  • followable_type string: Define the followable type, value can be Page or User.
  • followable_id integer : The id of the followable_type previously defined.
  • user_id integer : The id of the user who's followed element.

You also can pass those parameters as form-data instead of JSON.

Make sure to give your ApiTokenAPI and ApiSecretAPI as header in the HTTP request

curl -X POST \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/follows \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"followable_type": "User",
"followable_id": "THE_USER_UNIQUE_ID",
"user_id": "YOUR_USER_ID"
}'

List Follows of a user

You probably want to know all the follows of a user. Let's say you want to list all the followers of a perticular user.

Some filtering parameters are available, like pagination, by followable_id, followable_type... please refer to FollowsAPI.

curl -X GET \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/follows?followable_type=User&followable_id=YOUR_USER_UNIQUE_ID \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \

Follows list response

Follows listing are represented in a way to make your pagination easy. You will have a total_items key to help you for your pagination and also to give you the total pages informations. All your pages are inside a items key. A typical pages listing response will look like this :

{
"items":[
{
"id":"c273933a14524559adea2c48207f0ca7",
"followable_type":"User",
"followable_id":"7bf9a28647384196b6db238603cf245e",
"followable": {...}
...
},
{
"id":"69796cbffb5e40a48b2bf5a7f4457f15",
"followable_type":"User",
"followable_id":"7897f877a6eded28a6166340b191a896c9d67dbf",
"followable": {...}
...
}
],
"total_items":2
}