5 Replies Latest reply on Feb 5, 2015 12:03 PM by david.bastedo

    Cannot find discussion post when using REST api



      I have been trying somewhat unsuccessfully to find my test discussion posts to our cloud instance.


      I have been using a non federated test account with basic authentication, as our instance is set up to use SSO (SAML). I cannot see any posts in that (test) accounts content area. I have tried searching the whole of our instance with no luck. I do not receive any errors trying to connect , so I can only assume that I am missing something from my JSON request. I have also used Chrome's REST web service client to test and receive the same results.


      Below I have included both the request and response I receive:


      POST https://<jiveURL>/contents/

      Accept: application/json

      Content-Type: application/json

      Authorization: Basic am9lLmJsb2dnc0B2b2NhbGluay5jb206S2VpdGgxMjM=



      { "type": "text/html", "text": "

      Some interesting text to discuss today....

      " },

      "subject": "New Discussion",

      "type": "discussion",

      "parent": "https://<jiveUrl>/groups/recognition-awards/content",

      "visibility": "all"




      200, OK Date: Wed, 04 Feb 2015 14:22:03 GMT

      Content-Encoding: gzip

      Vary: Accept-Encoding P3P: CP="CAO PSA OUR"

      Server: Apache


      X-Jive-Request-Id: 30bcfe30-ac79-11e4-8516-005056b33d1f

      Content-Language: en-GB

      Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0 Transfer-Encoding: chunked Connection: keep-alive, Transfer-Encoding

      X-JSL: D=64364 t=1423059723666738

      Content-Type: text/html;charset=UTF-8

      X-Jive-Flow-Id: 30bcfe31-ac79-11e4-8516-005056b33d1f

      Expires: Wed, 04 Feb 2015 14:22:03 GMT


      Time taken (in milliseconds): 279


      Any suggestion of where to look would be most welcome.





        • Re: Cannot find discussion post when using REST api

          Hi Phil Nash -


          The "parent" object you specify in your JSON body has to point to the "places" API endpoint for a place, and not the actual URL that an end user would go to. For example, instead of https://<jiveUrl>/groups/recognition-awards/content you will want to use an API endpoint like https://<jiveurl>/api/core/v3/places/1102.  You'll need to use the API to find the correct place ID for your group.


          It also looks like the "visibility" is not a valid field to set when creating a new discussion.  Here is what worked for me:




          { "type": "text/html", "text": "Some interesting text to discuss today...." },

          "subject": "New Discussion",

          "type": "discussion",

          "parent": "<jiveurl>/api/core/v3/places/1102"



          When you run this API call you should get a a 201 response code, which is the response code for "Created".  The body of this response will be the JSON for the new piece of content, which should make it easy to find the new piece of content.


          When I ran the example code you have created I get a 400 error with the following returned text:


            "error" : {

              "code" : "placeInvalidURI",

              "message" : "A parent was specified for this content",

              "status" : 400




          I am surprised to see that you're getting a 200 response.  I'm not sure why that would be.


          Let me know if this helps.