It's all about the answers!

Ask a question

RAM Java API to get community forums


Anuradha Bhamidipaty (1322) | asked Jun 25 '13, 12:51 a.m.
Is there support in RAM Java API to get forums used by a community which are not necessarily linked to an asset?

Specifically, in a community homepage, one can see various tabs: Overview, Configuration, Forums, Statistics, Audit. How do we get a programmatic handle on the content of the Forums tab? These forums and topics are not linked to an asset.

Accepted answer


permanent link
Sheehan Anderson (1.2k4) | answered Jun 26 '13, 12:38 p.m.
JAZZ DEVELOPER
edited Jun 26 '13, 12:39 p.m.
It uses internal API, but the following code should do what you want.

RAMSession session = new RAMSession("http://localhost:8080/ram", "admin", "admin");
RAMCommunity community = session.getCommunity(1003);
AssetIdentification communityAssetId = null;
try {
	Method getInternalCommunity = community.getClass().getDeclaredMethod("getInternalCommunity");
	getInternalCommunity.setAccessible(true);
	CommunitySO internalCommunity = (CommunitySO)getInternalCommunity.invoke(community);
	communityAssetId = internalCommunity.getHomepageAsset().getIdentification();
} catch (SecurityException e) {
	e.printStackTrace();
} catch (NoSuchMethodException e) {
	e.printStackTrace();
} catch (IllegalArgumentException e) {
	e.printStackTrace();
} catch (IllegalAccessException e) {
	e.printStackTrace();
} catch (InvocationTargetException e) {
	e.printStackTrace();
}
		
RAMAsset asset = session.getAsset(communityAssetId);
Forum[] forums = asset.getForums();
for(Forum forum : forums) {
	System.out.println(forum.getTitle());
}
session.release();

Anuradha Bhamidipaty selected this answer as the correct answer

One other answer



permanent link
Rich Kulp (3.6k38) | answered Jun 25 '13, 9:46 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
One way to get them is as an RSS feed. When you open one of these forums there is an RSS link. You would copy that link and then use it with straight HTTP client code to access the forum.

Comments
Anuradha Bhamidipaty commented Jun 25 '13, 2:03 p.m.

Thanks Richard. Any suggestion on getting the list of forums to start with? Say, if a new forum is created, can it be detected?


Rich Kulp commented Jun 25 '13, 3:36 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

No, I don't know how to do that. I don't think there is any.


Gili Mendel commented Jun 26 '13, 8:30 a.m.
JAZZ DEVELOPER

When you create forums, you have an RSS feed link on the right top corner.
if you click on it, and show your page source, it is XML with RSS tag (http://www.w3schools.com/rss/default.asp)


Your answer


Register or to post your answer.