1 person found this helpful
unfortunately it is not possible to use the Jive REST API within HTML tiles. Please take a loot at Custom HTML in Your Jive Community .
HTML tiles are running in a separate domain, so pure AJAX is not working due to same origin policy.
The only way out is to put your html code into a custom view tile and install it as addon in your community.
We have a lot of experience doing that- we have developed a lot of tiles in the last years...
After reading your thread again I see you are talking about html widgets as well- do you want to run the code in a html widget or html tile?
When running this code in a html widget, the html widget is running in the same domain and you should be able to use AJAX to access the REST API.
Just use jQuery.ajax() or any other js library to make an AJAX call.
Some rest api calls like uploading an image (HTTP Post, Put and Delete methods) needs a csrf token which must be included in the http request...
If you need support, I would be available for an online session - please ping me via mail firstname.lastname@example.org.
I just noticed I referred to HTML tile in first sentence. I am using an HTML Widget.
I don't need anything beyond just GET request, as all I am doing is getting list of user's security groups to show them dynamic information based on their groups.
I'll give the AJAX a try. I assume osapi has the same cross origin restrictions (or rather are non existent) when using window.parent.osapi in an HTML widget as well?
Using AJAX accomplished what I wanted within an HTML Widget. Thank you for your help again!
What were you trying to do with OSAPI that you couldn't do with REST?
I wasn't trying to do anything that REST could not, but using OSAPI in Jive has been our go to within our custom Add Ons and I wanted to translate that over to other areas of Jive. I have no issue using REST to make the calls if they work.