D4Science D4Science Don't have a D4Science account? Create one Could not find what you are looking for? Contact us.

Likes Resource

REST interface for the social networking library (likes).

GET /2/likes/get-likes-by-post-id

Request Parameters
name type description constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources  
Content-Type header application/json  
key query required
Response Codes
code condition
200 The list of likes is put into the 'result' field
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON)

Example

Request
GET /2/likes/get-likes-by-post-id
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

POST /2/likes/like-post

Create a new like to a post in the context of the token

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Request Body
media type data type
application/json PostId (JSON)
Response Codes
code condition
201 Successful created, the like operation result is reported in the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) true if everything is OK

Example

Request
POST /2/likes/like-post
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "postId" : "..."
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /2/likes/unlike-post

Unlike to a post in the context of the token

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Request Body
media type data type
application/json LikeInputBean (JSON)
Response Codes
code condition
201 The unlike operation result is reported in the 'result' field of the returned object
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) true if everything is OK

Example

Request
POST /2/likes/unlike-post
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "likeid" : "...",
  "postid" : "..."
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...