Andreas Kohn created SHINDIG-1951:
-------------------------------------
Summary: Return the message id when a new message is posted for a
user
Key: SHINDIG-1951
URL: https://issues.apache.org/jira/browse/SHINDIG-1951
Project: Shindig
Issue Type: Improvement
Reporter: Andreas Kohn
When creating a message for a user the opensocial container MUST return the
message id, currently shindig's example container does not do that, nor does
the API allow it.
Attached patch changes MessageService#createMessage() to return a String, and
implements this for the JsonDbOpensocialService.
The patch also fixes the logic for JsonDbOpensocialService#createMessage(),
previously it would ignore the message collection (even though it is used
inside canonicaldb.json), and it would not set the message id if it wasn't set
in the request.
{noformat}
$ curl -D - -X POST -H Content-Type:application/json --data-binary
'{recipients:["jane.doe"],title:"Message",body:"Body",type:"email"}'
http://localhost:8080/social/rest/messages/john.doe/publicMessage
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
WWW-Authenticate: OAuth realm="shindig"
WWW-Authenticate: Bearer realm="shindig"
Access-Control-Allow-Origin: *
ETag: "116a202e8e39cad9ce8c764103c89608"
Content-Type: application/json;charset=UTF-8
Content-Length: 48
Date: Mon, 11 Nov 2013 15:46:16 GMT
{"entry":"980b4681-e4c7-46cd-9d40-8d7fe0751cef"}
{noformat}
And retrieving:
{noformat}
curl -D - -X GET -H Content-type:application/json
http://localhost:8080/social/rest/messages/jane.doe/publicMessage/980b4681-e4c7-46cd-9d40-8d7fe0751cef
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
WWW-Authenticate: OAuth realm="shindig"
WWW-Authenticate: Bearer realm="shindig"
Access-Control-Allow-Origin: *
ETag: "6c9116d8119f93eedd596420725de7ed"
Content-Type: application/json;charset=UTF-8
Content-Length: 347
Date: Mon, 11 Nov 2013 15:48:56 GMT
{"filtered":true,"startIndex":0,"totalResults":1,"sorted":true,"list":[{"recipients":["jane.doe"],"body":"Body","title":"Message","id":"980b4681-e4c7-46cd-9d40-8d7fe0751cef","type":"email"}],"updatedSince":true,"itemsPerPage":1}
{noformat}
--
This message was sent by Atlassian JIRA
(v6.1#6144)