RAM Java API to get community forums
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.
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
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();
One other answer
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.