Skip to content

Likes API

Fraser Redford edited this page Mar 29, 2021 · 20 revisions

GET author/<str:author_id>/post/<str:post_id>/likes

This will retrieve all likes for a given author.

Request Requirements

No body required

Sample Response

[
  {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Lara Croft Likes your post",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Lara Croft",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "github":"http://github.com/laracroft"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/800efa883dda1e11db47671c4a3bbd9e"
  },
  {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Jeff Likes your post",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Jeff",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
         "github":"http://github.com/Jeff"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e"
  }
]

Response Codes

  • 200 OK for a successful return of a list
  • 403 FORBIDDEN if the requesting user is not authenticated
  • 400 BAD REQUEST if information is missing in the request

GET author/<str:author_id>/post/<str:post_id>/comments/<str:comment_id>/likes

This will retrieve all the likes for a given comment specified in the path.

Request Requirements

No body required

Sample Response

[
  {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Lara Croft Likes your comment",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Lara Croft",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "github":"http://github.com/laracroft"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e/comments/8290318092abd80e9faaa9"
  },
  {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Jeff Likes your comment",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Jeff",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
         "github":"http://github.com/Jeff"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e/comments/8290318092abd80e9faaa9"
  }
]

Response Codes

  • 200 OK for a successful return of a list
  • 403 FORBIDDEN if the requesting user is not authenticated
  • 400 BAD REQUEST if information is missing in the request

GET author/<str:author_id>/liked

This will return a list of items that the given author has liked.

Request Requirements

No body required

Sample Response

[
   {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Lara Croft Likes your comment",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Lara Croft",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "github":"http://github.com/laracroft"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e/comments/8290318092abd80e9faaa9"
  },
  {
     "@context": "https://www.w3.org/ns/activitystreams",
     "summary": "Lara Croft Likes your post",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "host":"https://team6-project-socialdistrib.herokuapp.com/",
         "displayName":"Lara Croft",
         "url":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "github":"http://github.com/laracroft"
     },
     "object":"https://team6-project-socialdistrib.herokuapp.com/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/800efa883dda1e11db47671c4a3bbd9e"
  }
]

Response Code

  • 200 OK for a successful return of a list
  • 403 FORBIDDEN if the requesting user is not authenticated
  • 400 BAD REQUEST if information is missing in the request

Clone this wiki locally