Messages services REST interface
| name | type | description |
|---|---|---|
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| Content-Type | header | application/json |
| 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 |
| media type | data type | description |
|---|---|---|
| application/json | object (JSON) |
GET /2/messages/get-received-messages
Content-Type: */*
Accept: application/json
Authorization: ...
...
HTTP/1.1 200 OK
Content-Type: application/json
...
| name | type | description |
|---|---|---|
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| Content-Type | header | application/json |
| 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 |
| media type | data type | description |
|---|---|---|
| application/json | object (JSON) |
GET /2/messages/get-sent-messages
Content-Type: */*
Accept: application/json
Authorization: ...
...
HTTP/1.1 200 OK
Content-Type: application/json
...
Set message read or unread
| name | type | description | constraints |
|---|---|---|---|
| messageId | form | the message identifier | required |
| read | form | true to set read, false to set unread | boolean |
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources | |
| Content-Type | header | application/json |
| code | condition |
|---|---|
| 200 | Message set Read or Unread is correctly executed |
| 500 | The error is reported into the 'message' field of the returned object |
| media type | data type | description |
|---|---|---|
| application/json | object (JSON) | the result of the operation |
POST /2/messages/set-message-read
Content-Type: */*
Accept: application/json
Authorization: ...
...
HTTP/1.1 200 OK
Content-Type: application/json
...
Write a message to another user. The sender is the token's owner by default
| name | type | description |
|---|---|---|
| Authorization | header | Bearer token, see https://dev.d4science.org/how-to-access-resources |
| Content-Type | header | application/json |
| media type | data type | description |
|---|---|---|
| application/json | MessageInputBean (JSON) | The message to write" |
| 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 |
| media type | data type | description |
|---|---|---|
| application/json | object (JSON) | see response example |
POST /2/messages/write-message
Content-Type: application/json
Accept: application/json
Authorization: ...
{
"body" : "...",
"subject" : "...",
"recipients" : [ {
"id" : "john.smith"
}, {
"id" : "..."
} ],
"attachmentIds" : [ "...", "..." ]
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"success" : true,
"message" : null,
"result" : "556142e3-d6f5-4550-b2fa-abe5626625d3"
}