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

Messages Resource

Messages services REST interface

GET /2/messages/get-received-messages

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 read of the received messages, 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
GET /2/messages/get-received-messages
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

GET /2/messages/get-sent-messages

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 read of the sent messages, 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
GET /2/messages/get-sent-messages
Content-Type: */*
Accept: application/json
Authorization: ...

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

                
...
                
              

POST /2/messages/write-message

Write a message to another user. The sender is the token's owner by default

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 MessageInputBean (JSON) The message to write"
Response Codes
code condition
200 Successful write a message. Its id 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) see response example

Example

Request
POST /2/messages/write-message
Content-Type: application/json
Accept: application/json
Authorization: ...

                
{
  "body" : "...",
  "subject" : "...",
  "recipients" : [ {
    "id" : "john.smith"
  }, {
    "id" : "..."
  } ]
}
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "success" : true,
  "message" : null,
  "result" : "556142e3-d6f5-4550-b2fa-abe5626625d3"
}