5 Replies Latest reply on Oct 4, 2018 1:13 PM by james1.hicks

    Osapi in HTML Widgets? Alternatives for making calls to Jive API?

    james1.hicks

      We have an HTML tile in our Jive Cloud instance that requires the UI to render based on a user's security groups. Using Osapi would be the easiest way to do this.

       

      In the widgets Preview mode, I am able to get a response using Osapi. However once I publish the widget, I get " cannot read property 'jive' of undefined".

       

      I've read a few threads that have a few conflicting information (because they are from different years) where some say it is possible using window.parent and some say it is not.

       

      window.parent.osapi.jive.core.get({  
          v:"v3",  
          href:"/people/"+userId +"/securityGroups"  
      }).execute(function(response) {  
          console.log("Response is: " + JSON.stringify(response.content.list)); 
      for(var i = 0; i < response.content.list.length; i++){
      console.log(response.content.list[i].name)
      } 
      })
      

       

      This is the code I am using. As mentioned, this works when I hit 'Save Properties' of the html widget, but when I publish I get the error.

       

      Is there anyway in 2018 to get reach osapi in an HTML widget? Is there a reason why not? Is the alternative to just make a jQuery Ajax request? I read one thread that said this is also not supported.

       

      Any help would be greatly appreciated.

       

      Thank you,

      James