Forum API

Forum API

This API covers adding topic, adding reply, getting all topics, getting replies for a topic, deleting topic, deleting reply, closing a topic and re-opening a topic

Signature of API call

connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);

See details about invoking API in general

Add Topic

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch addTopic
xml true (optionally pass json=true instead)
groupId Group id for the forum (Optionally you can pass forumId instead of groupId, if you are using multiple forum setup in group)
name Topic's heading or title
content Main content for the topic

 

Response on successfully creating the topic

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
    <msgs>
        <msg><code>0080</code><value>Saved successfully.</value></msg>
    </msgs>
    <data>
        <topic id="xxxxxxx" entityId="xxxxxxx" entityType="GROUP" forumId="xxxxxxx" rating="0.0" ratedTimes="0" myRating="0" replyCount="0" createdDate="2015-01-01T02:47:13Z" lastPostDateUTC="" status="ACTIVE">
            <name>topic title</name>
            <content>topic content</content>
            <author id="xxxxxxx">
                <firstName>Mike</firstName>
                <lastName>"White" ccc</lastName>
            </author>
            <posts numItems="" currPage="">        
            </posts>
        </topic>
    </data>
</response>

List Topics

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch listTopics
xml true (optionally pass json=true instead)
entityId Group id (or course session id) for the forum (Optionally you can pass forumId)
entityType GROUP or COURSE_SESSION
Pagination (First call should be without pagination parameters, and subsequent calls must have these values)
numItems total records (send this for 2nd page onwards).
currPage page to fetch (0, 1, 2 .... etc)
pageSize page size for the list

 

Response

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<topics numItems="140" currPage="1" entityId="xxxxxxxxx" entityType="GROUP">
    <topic id="xxxxxxxxx" forumId="xxxxxxxxxxxxxx" rating="0.0" ratedTimes="0" myRating="0" replyCount="1" createdDate="2014-01-01T23:43:41Z" lastPostDateUTC="2015-02-01T05:13:10Z" status="ACTIVE">
        <name>topic title</name>
        <content>full content</content>
        <author id="xxxxxxxxxx">
            <firstName>John</firstName>
            <lastName>Doe</lastName>
        </author>
    </topic>
    .....
    .....
</topics>

Close Topic

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch closeTopic
xml true (optionally pass json=true instead)
id topic id

 

Delete Topic

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch deleteTopic
xml true (optionally pass json=true instead)
id topic id

 

Add Reply

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch addPost
xml true (optionally pass json=true instead)
topicId Topic id
content Main content for the reply posting

 

Get Topic Details (view all replies)

Parameter 1 - URI

forum.do

Parameter 2 - UserName

Username of the user making the call

Parameter 3 - Request Parameters

Name Value
dispatch listPosts
xml true (optionally pass json=true instead)
topicId Topic id
Pagination (First call should be without pagination parameters, and subsequent calls must have these values)
numItems total records (send this for 2nd page onwards).
currPage page to fetch (0, 1, 2 .... etc)
pageSize page size for the list

Response

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<topic id="xxxxxx" entityId="xxxxxx" entityType="GROUP" forumId="xxxxxx" rating="0.0" ratedTimes="0" myRating="0" replyCount="1" createdDate="2014-05-19T19:05:45Z" lastPostDateUTC="2015-01-02T06:34:21Z" status="ACTIVE">
    <name>Topic title</name>
    <content><p>topic content</p></content>
    <author id="xxxxxxxx">
    <firstName>John</firstName>
    <lastName>Doe</lastName>
    </author>
    <posts numItems="1" currPage="0">
        <post id="xxxxxxxx" createdDate="2015-01-02T06:34:21Z" status="ACTIVE">
            <content>reply post content</content>
            <author id="xxxxxxxx">
                <firstName>John</firstName>
                <lastName>Doe</lastName>
            </author>
        </post>
        .....
        .....
    </posts>
</topic>

 

Code Snippet

    /*  Check API Call for detail generic code */
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("dispatch", "forum.do");
    parameters.put("xml", String.valueOf(true));
    parameters.put("groupId", "xxxxxx"); //Optionally you can pass forumId too
    parameters.put("name", "topic title");
    parameters.put("content", "topic content");
    String retStr = connection.invokeApi("groupService.do", "adminusername", parameters);
    System.out.println(retStr);
   
   

 

 


Rating: