-
Notifications
You must be signed in to change notification settings - Fork 3
Followers API Documentation
API used to manage all aspects of user/author's followers on Konnection. It offers endpoints so users can follow, unfollow, check if follower and follower list.
GET: /api/author/{author_id}/followers
Getting an author's follower list.
- Provide Token in the header for authentication purpose
- Logged in user must be approved by admin
Request Header | Required / optional | Description | Type |
---|---|---|---|
Authorization | required | Authentication Token | String |
Sample header
--header "Authorization: Token 7ccf51cf9b2b518d789bdeaf5de1db0e530e1ab5"
Note: Only JSON object is accepted
Payload | Required / optional | Description | Type | More |
---|---|---|---|---|
type | Optional | Action Type | JSON field | |
summary | Optional | Description of the action | JSON Field | |
actor | Required | Author object that is going to follow another author | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
object | Required | Author object that is being followed | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
Sample Payload
{
"type": "Follow",
"summary":"AuthorA wants to follow AuthorB",
"actor":{
"type":"author",
"id":"1d698d25ff008f7538453c120f581471",
"url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471",
"host":"http://team6/",
"displayName":"AuthorA",
"github": ""
},
"object":{
"type":"author",
"id":"9de17f29c12e8f97bcbbd34cc908f1baba40658e",
"host":"https://konnection-client.herokuapp.com",
"displayName":"AuthorB",
"url":"",
"github": "http://github.com/AuthorB"
}
}
The following is a sample response from the endpoint:
{
"type": "followers",
"items": [
{
"username": "abc123",
"type": "Author",
"id": "63248785-c0b0-4e54-b2e9-4477ewfhiwefniwuen",
"host": "http://127.0.0.1:8000",
"displayName": "",
"url": "",
"github": ""
},
...
]
}
Response Status Code
- 200 OK: If all requirements are fulfilled
- 400 Bad Request: If the author ID is invalid
- 401 Unauthorized: If basic auth or token is not provided
GET: /api/author/{authorA_id}/followers/{authorB_id}
Checking if author B follows author A
- Provide Token in the header for authentication purpose
- Logged in user must be approved by admin
Request Header | Required / optional | Description | Type |
---|---|---|---|
Authorization | required | Authentication Token | String |
Sample header
--header "Authorization: Token 7ccf51cf9b2b518d789bdeaf5de1db0e530e1ab5"
Note: Only JSON object is accepted
Payload | Required / optional | Description | Type | More |
---|---|---|---|---|
type | Optional | Action Type | JSON field | |
summary | Optional | Description of the action | JSON Field | |
actor | Required | Author object that is going to follow another author | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
object | Required | Author object that is being followed | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
Sample Payload
{
"type": "Follow",
"summary":"AuthorA wants to follow AuthorB",
"actor":{
"type":"author",
"id":"1d698d25ff008f7538453c120f581471",
"url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471",
"host":"http://team6/",
"displayName":"AuthorA",
"github": ""
},
"object":{
"type":"author",
"id":"9de17f29c12e8f97bcbbd34cc908f1baba40658e",
"host":"https://konnection-client.herokuapp.com",
"displayName":"AuthorB",
"url":"",
"github": "http://github.com/AuthorB"
}
}
The following is a sample response from the endpoint:
{
"type": "follower",
"items": [
{
"status": true,
"author": "author A uuid",
"follower": "author B uuid"
}
]
}
Response Status Code
- 200 OK: If all requirements are fulfilled
- 400 Bad Request: If either of the author IDs is invalid
- 401 Unauthorized: If basic auth or token is not provided
PUT: /api/author/{authorA_id}/followers/{authorB_id}/
Author B follows A and author B will be the follower of author A. This endpoint is equivalent to sending friend request and the response object will be added to the inbox.
- Provide Token in the header for authentication purpose
- Logged in user must be approved by admin
Request Header | Required / optional | Description | Type |
---|---|---|---|
Authorization | required | Authentication Token | String |
Sample header
--header "Authorization: Token 7ccf51cf9b2b518d789bdeaf5de1db0e530e1ab5"
Note: Only JSON object is accepted
Payload | Required / optional | Description | Type | More |
---|---|---|---|---|
type | Optional | Action Type | JSON field | |
summary | Optional | Description of the action | JSON Field | |
actor | Required | Author object that is going to follow another author | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
object | Required | Author object that is being followed | JSON Object | Please ensure that correct author object is passed. Required fields: type, id, url, host displayName, and github |
Sample Payload
{
"type": "Follow",
"summary":"AuthorA wants to follow AuthorB",
"actor":{
"type":"author",
"id":"1d698d25ff008f7538453c120f581471",
"url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471",
"host":"http://team6/",
"displayName":"AuthorA",
"github": ""
},
"object":{
"type":"author",
"id":"9de17f29c12e8f97bcbbd34cc908f1baba40658e",
"host":"https://konnection-client.herokuapp.com",
"displayName":"AuthorB",
"url":"",
"github": "http://github.com/AuthorB"
}
}
Response Status Code
- 200 OK: If all requirements are fulfilled
- 400 Bad Request: If either of the author IDs is invalid
- 401 Unauthorized: If basic auth or token is not provided
- 404 Not Found: If the author you are trying to follow is invalid
The following is a sample response from the endpoint:
{
"type": "follower",
"items": [
{
"status": true,
"author": "author A uuid",
"follower": "author B uuid"
}
]
}
DELETE: /api/author/{authorA_id}/followers/{authorB_id}
Author B unfollows author A.
- Provide Token in the header for authentication purpose
- Logged in user must be approved by admin
Request Header | Required / optional | Description | Type |
---|---|---|---|
Authorization | required | Authentication Token | String |
Sample header
--header "Authorization: Token 7ccf51cf9b2b518d789bdeaf5de1db0e530e1ab5"
The following is a sample response from the endpoint:
{
"type": "unfollow",
"items": [
{
"status": false,
"author": "author A uuid",
"follower": "author B uuid"
}
]
}
Response Status Code
- 200 OK: If all requirements are fulfilled
- 400 Bad Request: If either of the author IDs is invalid
- 401 Unauthorized: If basic auth or token is not provided