4 Replies Latest reply on Feb 3, 2015 12:26 AM by philn

    Create a discussion using REST api


      Hi, I am trying to create a discussion remotely on our cloud instance using the REST api. Our cloud instance is set up for SSO but I am using a non federated account with basic authentication. I can see that I can make a connection and have permission within the (private group). I am not receiving any http status errors, the URL I am targetting is https://myinstance.jiveon.com/groups/privategroup/contents/ but all my test messages fail to appear within the groups content area. I am using the following JSON: {   "content":       {       "type": "text/html",       "text": "

      Some interesting text to discuss

      "       },   "subject": "New Discussion",   "type": "discussion"   } which I took from the jive documentation. I am sure i'm missing something obviuos but any help would be appreciated. Many thanks, Phil

        • Re: Create a discussion using REST api

          Hi Phil Nash - I have a few questions here to help figure out why this API call isn't working for you:


          1. What is the API end point URI you're making this request to? It should be /api/core/v3/contents
          2. Can you also confirm if you're setting the Content-Type header to application/json in your request?
          3. In any API call you should always get a response code back from the Jive server when you attempt to make the API call.  What is the response code and message? This will help tell us what the issue is.


          To test this out, I ran an API call against a Jive site using the json content you provided and I was able to successfully create a new discussion.


          Request Method: POST


          Request URL: <JiveURL>/api/core/v3/contents


          Request Headers:


          Authorization: Basic ##################

          Content-Type: application/json


          Request Body Data:

          { "content": { "type": "text/html", "text": " Some interesting text to discuss" }, "subject": "New Discussion", "type": "discussion" }



          Lastly, if you want to create a new discussion in a specific place, as your post suggests, then this will have to be included in the body of your json data that you're using.  For example, if I want to create a discussion in the place that has the API endpoint of <jiveURL>/api/core/v3/places/1058, then my json data will look like the following:


          Request URL: <JiveURL>/api/core/v3/contents

          Request Body Data:

          { "content": { "type": "text/html", "text": " Some interesting text to discuss" }, "subject": "New Discussion", "type": "discussion", "parent": "<jiveURL>/api/core/v3/places/1058" }


          There are some basic examples of an API call here: How to: The Basics of using Jive's REST API

            • Re: Create a discussion using REST api

              Hi David, Many thanks for the reply. In answer to your questions : 1. /groups/mygroup/contents/ 2. Yes i have set the content type to application/json 3. I get a status of ok in the request description which i guess will be a status code 200 4. Yes the requirement i have is to post comments/discussion to a group within our instance. I'll just work out the correct URL for the group and add that into the JSON object i create. It's just that my test messages appeared to work but i have no idea where they were posted to. Thanks, Phil