2 Replies Latest reply on Sep 30, 2014 3:49 PM by sushruth

    Create discussion using REST api..getting 403

    sushruth

      Hi,

       

      I am a jive noob was trying out jive's rest api. We have a UAT environment https://uat.community.servicenow.com/  i am able to login and create discussion there. But when i try to create a discussion through rest api i get

      "message":"This content type is not allowed in this place or you do not have permissions to create this content","status":403

       

      curl i used was

      curl -v -u user:password -H "Content-Type: application/json" --data '{"type": "discussion","status" : "published","content": { "type": "text/html", "text":"<p>Starting a discussion</p>"}, "subject": " new Test discussion"}' "https://uat.community.servicenow.com/api/core/v3/contents"

       

      Using curl I am able to do update

       

      This works!

      curl -v -u user:password -H "Content-Type: application/json" --data '{"type": "update","status" : "published","content": { "type": "text/html", "text":"<p>Starting a discussion</p>"}, "subject": " new Test discussion"}' "https://uat.community.servicenow.com/api/core/v3/contents"

       

       

      I am not sure if i am missing something. Any help here is appreciated.

       

      Thanks,

      Sush

       

      Ryan Rutan

        • Re: Create discussion using REST api..getting 403
          Ryan Rutan

          It looks like you are not defining the  Parent Place for the discussion (and probably have personal discussions disabled), while status updates can be global.

          curl -v -u user:password -H "Content-Type: application/json" --data '{"visibility" : "place", "parent": "JIVE API PLACE URL", "type": "discussion","status" : "published","content": { "type": "text/html", "text":"<p>Starting a discussion</p>"}, "subject": " new Test discussion"}' "https://uat.community.servicenow.com/api/core/v3/contents"

          You'll need to replace the Jive API Place URL with an API URL you get from

          /api/core/v3/places


          More examples can be found here:

          REST API v3 Examples


          Hope that helps.

            • Re: Create discussion using REST api..getting 403
              sushruth

              Hi Ryan,

               

              Appreciate your response. I was just trying out examples straight from the Jive REST Rest API v3.8 → Content service , didn't realize that discussions should be associated with a place. Your above approach worked.

               

              Had one more question about discussions. We have a content/document and people should be able to create multiple discussions around this, messages in reply to these discussions, likes etc.

               

              Right now it looks like all discussions are related to a place. How can we have multiple discussions for a content? should we create a new place for a new content just to group all discussions for that place?

               

              Other thing i found was, blogs seem to have a good way grouping all comments for that blog in one place. Is it easier to create a blog for our content and manage comments?

               

              TIA,

              Sush