Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1951

Return the message id when a new message is posted for a user

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 2.5.0-update1
    • None
    • None
    • None

    Description

      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.

      $ 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"}
      

      And retrieving:

      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}
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ankon Andreas Kohn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: