6 Replies Latest reply on Dec 2, 2013 2:21 AM by pawans

    Need some help with v3 apis



      We are on jive version 6.0.2.

      I am trying to create a script which creates a new email enabled custom stream for a user.

      And then associate a jive group with this stream.

      This script will be outside jive in a different system (i.e. it is not part of any plugin or jive app).

      And I am trying to use v3 apis for this.


      Whenever I call the "GET" methods on apis from browser or curl command, it works.

      But to call POST method, I have to provide an input json.

      I am not able to get the right json for my task.

      I tried checking network calls on jive 7 sandbox. But it seems jive calls v2 apis on jive 7 instead of v3.

      Can someone help with this?


      Ryan Rutan, I am hoping you can resolve this

        • Re: Need some help with v3 apis

          To be clear you are wanting me to help you with curl statements, or confirm the use of v2 alums. Sorry a bit confused on the ask.

            • Re: Need some help with v3 apis

              Hi Ryan,

              Sorry if I confused you.

              Let me try to make it simple.


              The reason I mentioned v2 apis is i saw it being called in jive 7 when a user tries to follow something in a stream.

              Due to this my attempt to get a correct json for api request failed.

              I don't need any help wrt v2.


              Also I am not using any curl statements to hit the apis (But I might end up doing this for testing purpose).

              I have a java code which is totally independent of jive.

              From this code, based on some conditions or actions, I am trying to call apis on jive to either create a new stream or add association.

              The api documentation says I need to create a add json which has required input parameters with the POST request (for createAssociation or createStream).

              I tried this using an online REST debugger, but i get error as follows


              Status Code: 406 Not Acceptable

              href="chrome://global/locale/intl.css" type="text/css"
              XML Parsing Error: no element found Location: https://jive-url/api/core/v3/streams/10617/associations Line Number 1, Column 1:
              <sourcetext> ^</sourcetext>


              I am not able to get this right and need help with an example about how to create this entire request.

              Or basically how to use v3 apis to create streams and add associations with a POST request example.

              And that too from a system outside jive.

                • Re: Need some help with v3 apis

                  Hi Pawan,


                  I've had a play with this today using the RESTClient extension in Firefox and after adding the Basic Authentication entries and a custom Content-Type (application/json) to the Header section, I made the following call:

                  POST https://jive-url/api/core/v3/people/2007/streams

                  With a request body of:


                    "name" : "Martin Test Stream",

                    "source" : "custom"


                  And I received the following response along with the corresponding JSON for the newly created Stream:

                  Status Code: 201 Created

                  From my testing I believe the problem you're facing is due to the Content-Type not being set correctly, because I got the same response when I didn't have it set


                  I hope this helps.




                    • Re: Need some help with v3 apis

                      Just getting back to this this morning, and not to stand on the shoulders of Martin (thanks btw) =)  But that is probably the issue.  Whenever you do a POST/PUT or any other REST service call with a write/modify you need to declare the Content-Type as "application/json" via the Header.  This allows the service end-point to interpret the data with the right parsing logic.  In general, you should always set "Content-Type" and "Accepts" header to "application/json" when doing read-write.


                      Hope Martin's and this feedback help.

                      1 person found this helpful
                    • Re: Need some help with v3 apis

                      Please post also your Json data if setting the content-type does not help. The API doc is very limited regarding the needed Json format ro create stream associations.

                      1 person found this helpful
                  • Re: Need some help with v3 apis

                    Thanks a lot Martin and Ryan Rutan, Its working now.

                    The content type was the problem with our request header.