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

Posts Resource

REST interface for the social networking library (posts).

GET /2/posts/get-id-liked-posts

Retrieve ids (UUID) of the liked posts by the user

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
201 Sccessfull retrieved ids, they are 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) ids (UUID) of the liked posts by the user in the context bound to the auth token

Example

Request
GET /2/posts/get-id-liked-posts
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

GET /2/posts/get-liked-posts

Retrieve posts liked by the user

Request Parameters
name type description default constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources    
Content-Type header application/json    
limit query The maximum number of posts to be retrieved 10 min: 0
Response Codes
code condition
200 Successfull retrieved posts, they are 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) posts liked by the user (up to a given quantity) in the context bound to the auth token

Example

Request
GET /2/posts/get-liked-posts
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/posts/get-post

Retrieve a post by id

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
id query
Response Codes
code condition
200 Successful retrieval of posts, 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) the post if the post id belongs to a post in the context identified by the token

Example

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

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

                
...
                
              

GET /2/posts/get-posts-app

Retrieve the application's posts

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 Successfull created, the new post is reported in the 'result' field of the returned object
403 "There is no application profile with such token
500 The error is reported into the 'message' field of the returned object
Response Body
media type data type description
application/json object (JSON) the application (IAM Client) posts belonging to the token's owner (i.e., an application)"

Example

Request
GET /2/posts/get-posts-app
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/posts/get-posts-by-hashtag

Retrieve posts containing the hashtag in the context bound to the auth token

Request Parameters
name type description constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources  
Content-Type header application/json  
hashtag query he hashtag to be contained within the posts required
Response Codes
code condition
201 Sccessfull retrieved posts, they are 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) the posts in the context bound to the auth token matching the hashtag

Example

Request
GET /get-posts-by-hashtag?hashtag=#thehashtag
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

GET /2/posts/get-posts-user

Retrieve all user's posts

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
200 Successful retrieval of posts, 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) all posts of the auth token's owner in the context identified by the token

Example

Request
GET /2/posts/get-posts-user
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/posts/get-posts-user-quantity

Retrieve a given quantity of latest user's posts

Request Parameters
name type description default constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources    
Content-Type header application/json    
quantity query the number of latest post to get 10 min: 0
Response Codes
code condition
200 Successful retrieval of posts, 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) all posts of the auth token's owner in the context identified by the token, in reverse chronological order up to quantity (at most)

Example

Request
GET /get-posts-user-quantity?quantity=10
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/posts/get-posts-user-since

Retrieve posts of the auth token's owner, and allow to filter them by time"

Request Parameters
name type description constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources  
Content-Type header application/json  
time query The reference time since when retrieving posts required long, min: 0
Response Codes
code condition
200 Successful retrieval of posts, 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) the posts

Example

Request
GET /2/posts/get-posts-user-since
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/posts/get-posts-vre

Request Parameters
name type description
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources
Content-Type header application/json
Response Codes
code condition
201 Sccessfull retrieved posts, they are 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) all the posts in the context bound to the auth token

Example

Request
GET /2/posts/get-posts-vre
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

GET /2/posts/get-recent-posts-vre-by-range

return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletions

Request Parameters
name type description constraints
Authorization header Bearer token, see https://dev.d4science.org/how-to-access-resources  
Content-Type header application/json  
from query the range start (most recent feeds for this vre) has to be greater than 0 required int, min: 1
quantity query the number of most recent feeds for this vre starting from "from" param required int, min: 1
Response Codes
code condition
201 Sccessfull retrieved posts, they are 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) a RangePosts containing of most recent feeds for this vre

Example

Request
GET /get-recent-posts-vre-by-range?from=1&quantity=10
Content-Type: */*
Accept: application/json
Authorization: ...

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /2/posts/save-app-post-attachments-lib

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 PostWithAttachment (JSON)
Response Body
media type data type description
application/json object (JSON)

Example

Request
POST /2/posts/save-app-post-attachments-lib
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "attachments" : [ {
    "uri" : "...",
    "name" : "...",
    "id" : "...",
    "description" : "...",
    "thumbnailURL" : "...",
    "mimeType" : "..."
  }, {
    "uri" : "...",
    "name" : "...",
    "id" : "...",
    "description" : "...",
    "thumbnailURL" : "...",
    "mimeType" : "..."
  } ],
  "post" : {
    "time" : 12345,
    "linkHost" : "...",
    "commentsNo" : "...",
    "likesNo" : "...",
    "entityId" : "...",
    "fullName" : "...",
    "uri" : "...",
    "uriThumbnail" : "...",
    "email" : "...",
    "thumbnailURL" : "...",
    "applicationFeed" : true,
    "privacy" : "CONNECTION",
    "key" : "...",
    "linkDescription" : "...",
    "multiFileUpload" : true,
    "linkTitle" : "...",
    "type" : "JOIN",
    "description" : "...",
    "vreid" : "..."
  }
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /2/posts/save-user-post-attachments-lib

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 PostWithAttachment (JSON)
Response Body
media type data type description
application/json object (JSON)

Example

Request
POST /2/posts/save-user-post-attachments-lib
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "attachments" : [ {
    "uri" : "...",
    "name" : "...",
    "id" : "...",
    "description" : "...",
    "thumbnailURL" : "...",
    "mimeType" : "..."
  }, {
    "uri" : "...",
    "name" : "...",
    "id" : "...",
    "description" : "...",
    "thumbnailURL" : "...",
    "mimeType" : "..."
  } ],
  "post" : {
    "time" : 12345,
    "linkHost" : "...",
    "commentsNo" : "...",
    "likesNo" : "...",
    "entityId" : "...",
    "fullName" : "...",
    "uri" : "...",
    "uriThumbnail" : "...",
    "email" : "...",
    "thumbnailURL" : "...",
    "applicationFeed" : true,
    "privacy" : "PORTAL",
    "key" : "...",
    "linkDescription" : "...",
    "multiFileUpload" : true,
    "linkTitle" : "...",
    "type" : "TWEET",
    "description" : "...",
    "vreid" : "..."
  }
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /2/posts/write-post-app

Create a new application post having as owner-application the token's owner (the IAM Client), note that the application must be registered on the Information System

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 description
application/json PostInputBean (JSON) The post to be written
Response Codes
code condition
200 Successfull created, the new post is reported in the 'result' field of the returned object
403 "There is no application profile with such token
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
POST /2/posts/write-post-app
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "text" : "Dear vre members, ...",
  "preview_description" : "...",
  "preview_host" : "...",
  "preview_url" : "...",
  "image_url" : "...",
  "enable_notification" : true,
  "params" : "...",
  "previewtitle" : "..."
}
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

POST /2/posts/write-post-user

Create a new user post having as owner the auth token's owner

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 description
application/json PostInputBean (JSON) The post to be written
Response Codes
code condition
201 Successfull created, the new post 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)

Example

Request
POST /2/posts/write-post-user
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "text" : "Dear vre members, ...",
  "preview_description" : "...",
  "preview_host" : "...",
  "preview_url" : "...",
  "image_url" : "...",
  "enable_notification" : true,
  "params" : "...",
  "previewtitle" : "..."
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...