At Oracle Open World (OOW) Martin and I had a lot of fun integrating the Oracle Social Network (OSN) with Oracle Application Express (APEX).
In short there was a developer challenge at OOW where teams had to find a good use case to integrate OSN with the technology of your choice... Martin and I obviously used APEX... and we won! We hacked it together in one night! Jake (one of the organisers) wrote a nice blog post about it or you can read about it on the Oracle Blog. In that post there's a video of Martin and I smiling because the jury just told us we won :-)
Here's a video where you can see what we build:
The Oracle Social Network is still in beta and we got only access to it during OOW (and a couple of days after to make the video). During the challenge we used the PL/SQL API which was part of the documentation (edit: I'm unsure what we got will be part of the production release, as it was Noel Portugal who build that example for the challenge. Thanks Noel!). As we have some great web service API's in APEX I immediately thought to try to use those. Unfortunately during the challenge we didn't have enough time to get things working, but straight after I discussed with Jason Straub and after he told me I didn't need to specifically set the complete headers, it was working great (Thanks Jason!).
Below I try to explain the most important parts of the code.
To integrate with OSN you can use RESTfull webservices. The OSN documentation is a great resource and the calls are well documented.
Line 119 shows the url you need to do to post a new message. You post a message to a conversation. In the full package you can see how to create a conversation too.
Line 120 shows what you have to post, basically a json string with the message.
Line 121 shows the REST request; you call a url, and do a post with in the body the json string. As everything is going over https you have to have your Oracle wallet configured with the certificate.
If you look at the complete osn_pkg package, the submit_osn procedure is the call we do in the video. As OSN is secured you first have to connect with a username and password. You get back a cookie and random id and you have to set that in the header of all the next calls.
By using the apex_web_service package you only need to set the headers once. Next in the procedure we create a new conversation, we add more members to it so others can participate in the conversation. In the conversation we add a message and a document (screenshot) if there's one.
I made the package open source on GitHub, so you can see the complete package there and you can quickly integrate with OSN from APEX. The only thing I want to ask is, if you improve it or integrate other parts of the Oracle Social Network once it launches, give your code back as well so we can use this project as a great source for the OSN and APEX community.
Hope you like it...
13 comments:
Thanks Dimitri,
Actually, Me and some other people are looking to enabling live chat between APEX application end users.
There are a few threads on OTN, but it is not clear..
Best Regards,
Fateh
Congratulations Dimitri!
Have you ever thought about creating an e-book or guest authoring on other
blogs? I have a blog centered on the same ideas you discuss and would really like to have you share some stories/information.
I know my readers would enjoy your work. If you're even remotely interested, feel free to send me an e mail.
Also visit my web page le meilleur blog de referencement google
I am curious about "The OSN documentation is a great resource and the calls are well documented". Maybe they were documented for this OOW challenge? No amnount of searching Oracle documentation helps to find that RESTful API. Is there any reference you could share? Thanks
Yes, I only saw the documentation at the time of OOW. I'm unsure how the doc looks like today.
Well Done,
But more details on adding screenshots is needed, kindly
Omar
Hi Dmitri,
How the screenshot trick is done, any clue would be great.
Omar
Can you explain how one would execute the submit_osn procedure? I see that the p_type field is used in the conversation procedure, but what does the conversation procedure actually do? It appears to return a conversation / folder ID but I'm still confused what the p_type actually is.
Hi Dmitri,
We have an APEX app and want to upload documents to OSN conversations. Both the app and the OSN instance use SSO. Could you please share some thoughts on how to upload document to OSN from APEX.
Thanks,
Shuvo
Hi Dmitri,
I am trying to post the data to OSN using REST API.This is syntax given in the documentation
Headers :
Content-Type: application/json; charset=utf-8
X-Waggle-RandomID: random-ID
Cookie: cookie-value
I am stuck with this Random Id.Could you please tell me how to generate this Id.
Thanks
Anu
I'm sorry Any, it's a long time ago I did OSN.
I guess it's just a unique ID, you could use sys_guid() to generate one?
Hi Dmitri,
Is there any way to log into (authenticate) OSN using REST API?
Hi Dmitri,
I am trying to get the data(json format) by using REST API.
And then pass the data to Oracle APEX jet charts to display.
Could you please tell me how can i do it.
Thanks!
Post a Comment