Community articleActing on a forum topic or reply that is awaiting approval
Added by IBM contributorIBM on March 11, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

To programmatically take action on a forum topic or reply that is waiting to be approved, send an Atom entry document that defines the action you want to take to the moderation action feed.



To programmatically take action on a forum topic or reply that is waiting to be approved, send an Atom entry document that defines the action you want to take to the moderation action feed.

Only a person added to the global-moderator role of the Forums application can take action on a forum topic or reply awaiting approval.

See Authenticating requests for information about how to authenticate the request.

To take action on an topic or reply awaiting approval, complete the following steps:


approve
Approves the topic or reply and publishes it to the forum.
reject
Rejects the request for publication and does not publish the topic or reply.
Construct an <snx:in-ref-to> element that identifies the topic or reply that you want to take action on using one of the following syntax options:
<snx:in-ref-to xmlns:snx="http://www.ibm.com/xmlns/prod/sn"
rel="http://www.ibm.com/xmlns/prod/sn/report-item"
ref-item-type="forum-topic"
ref="urn:lsid:ibm.com:forum:<entry_ID>">
</snx:in-ref-to>

<snx:in-ref-to xmlns:snx="http://www.ibm.com/xmlns/prod/sn"
rel="http://www.ibm.com/xmlns/prod/sn/report-item"
ref-item-type="forum-reply"
ref="urn:lsid:ibm.com:forum:entry_ID">
</snx:in-ref-to>
  • Topic:
  • Reply:
where entry_ID is the value specified as the topicUuid or replyUuid in the edit link URL. For example, if the edit <link> is

<link
href="https://linux276.rtp.raleigh.ibm.com/forums/atom/approval/topic?
topicUuid=2138b739-f358-4dec-b8e4-b8a5c60d051c"
rel="edit"
type="application/atom+xml"/>


then the <entry_ID> value to use is 2138b739-f358-4dec-b8e4-b8a5c60d051c.

For example, to approve a topic, the Atom entry document might contain the following content:

<?xml version="1.0"?>
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>ignored</id>
<title>ignored</title>
<author>
<name>ignored</name> <!-- taken from authenticated moderator user -->
</author>
<snx:in-ref-to xmlns:snx="http://www.ibm.com/xmlns/prod/sn"
rel="http://www.ibm.com/xmlns/prod/sn/report-item"
ref-item-type="forum-topic"
ref="urn:lsid:ibm.com:forum:2138b739-f358-4dec-b8e4-b8a5c60d051c">
</snx:in-ref-to>
<snx:moderation action="approve" />
<content>This content of this entry is not objectionable according to
company guidelines.</content>
</entry>
1. Retrieve the moderation service document. See Retrieving the Forums moderation service document for more details.
2. In the service document, find the collection with the <atom:category term="approval-action" .../> child element, and make a note of the web address in its href attribute.
3. Find the edit link of the topic or reply that you want to take action on by getting a list of the entries awaiting approval. See Getting a list of topics and replies that require action for more details. Make a note of the href attribute of the edit link for the entry representing the forum topic or reply.
4. Create an Atom entry document that defines the action you want to perform. In the <snx:moderation action="xxx" /> element, choose one of the following options:
5. Send a POST request to the web address that you noted in Step 2. Pass the Atom entry document that you created in the previous step as input on the request.
Input
Method URI Description
POST /forums/atom/approval/actions Value of the href attribute of the <collection> element that has the <atom:category term="approval-action" .../> child element in the moderation service document.
- Change pre-moderated forum content approval status collection
Content Type: application/atom+xml
Output
Code Description
200
OK. Indicates that the topic or reply was successfully moderated. If an error occurs, this header contains one of the error codes.
400
Bad Request.
401
Unauthorized.
403
Forbidden. Returned when the current user is authorized to the use the API, but cannot moderate the specified content.
404
Not Found. Indicates that the content is no longer available.

Examples
> POST /forums/atom/approval/actions HTTP/1.1

	> Authorization: xxx

	> Host: enterprise.example.com

	> Accept: */*

	> Content-Type: application/atom+xml

	> Content-Length: 616


Response returned by the server
< HTTP/1.1 200 OK