Hi Jivers,


All the jive client developers who have been developing jive add-ons for a while certainly have used the jive rest apis.

 

We at ThoughtWorks have been using server side component for almost all of our jive add-ons with help of jive connects. Server component internally calls jive REST apis. In the past we have developed different add-ons and endup up duplicating the api client code at several places. So recently I thought of creating reusable node modulefor calling REST apis, which looks a bit simialr to the JS apis.


Some of you must have seenhttp://internally call jive REST apis/my previous blog which talked about using jive-sdk to make REST api calls. On the same theory I have developed a open source  node module on github


On client side we have an easy to use JS api which provides us method endpoints like this


osapi.jive.corev3.group.get(<group-url>)




On server side we have following method given by jive-sdk to make REST Calls.

 

jive.community.doRequest(<params>)

 

 

I thought it would be good to have something like the JS apis on server side which provides  easy to use end points for REST apis. An example for this nice jive-sdk method on server side would be something like this:


 

api.group.get(<group-url>)

 

So here's my attempt to add these friendly endpoints to jive-sdk. Its obviously not a complete solution. So I would appreciate if people can give feedback and also help add more wrapper methods to this.


How to use this wrapper?


Just add the github url in your add-on's package.json as follows:

 

Package.json

 

"dependencies": {
    "jive-api-client": "git+https://github.com/shilpakondawar/jive-api-client.git",
}







 

 

Code usage:

 

var jive= require('jive-api-client');
var api = jive("https://jive.example.com");

api.group.get("https://jive.example.com/api/core/v3/places/17257").
  then(function(groupData){
  console.log("groupData",groupData);},
  function(error){
  console.log("Something got wrong",error)});

api.request({url:"https://jive.example.com/api/core/v3/search/places?filter=search(%22test%22)", method:"GET"})
  .then(function (places) {
  console.log("Searched places:", places);},
  function (err) {
  console.log(err);});

 

 

I have added few wrappers and also examples for them in the library. In future I am planning to create npm module and add some more widely usable wrappers. For the time enjoy and use the github code.