Act on a flagged forum topics and replies
To programmatically take action on a forum topic or reply that has been flagged as inappropriate, 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 flagged forum topics and replies.
See Authenticating requests for information about how to authenticate the request.
To take action on a flagged topic or reply...
- Retrieve the moderation service document. See Retrieve the Forums moderation service document for more details.
- In the service document, find the collection with the <atom:category term="review-action" .../> child element, and make a note of the web address in its href attribute.
- Find the history link of the topic or reply that you want to take action on by getting a list of flagged topics and replies. See Getting a list of flagged forum topics and replies for more details. Make a note of the href attribute of the <link> element that has the rel="http://www.ibm.com/xmlns/prod/sn/history" attribute for the entry representing the forum topic or reply.
- 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:
dismiss
Dismissed the flag, but does not change the status of the entry.
quarantine
Removes the content from public view.
restore
Dismisses all flags and changes the status to active.
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:
- Topic:
<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>
- Reply:
<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>
where <entry_ID> is the value specified as the topicUuid or replyUuid in the history link URL. For example, if the history <link> is
<link href="https://linux276.rtp.raleigh.ibm.com/forums/atom/review/actions? replyUuid=e53238fc-023d-47e0-8572-0d919ba2b053" rel="http://www.ibm.com/xmlns/prod/sn/history" type="application/atom+xml"/>then the <entry_ID> value to use is e53238fc-023d-47e0-8572-0d919ba2b053.
For example, to quarantine a reply, 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-reply" ref="urn:lsid:ibm.com:forum:e53238fc-023d-47e0-8572-0d919ba2b053"> </snx:in-ref-to> <snx:moderation action="quarantine" /> <content>This content of this reply is objectionable according to company guidelines.</content> </entry>
- 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.
Table 1. Atom API request details
Method Resource URI Input representation POST Change post-moderated content review status collection Value of the href attribute of the <collection> element that has the <atom:category term="review-action" .../> child element in the moderation service document. moderation action
Input
Provide a moderation action Atom entry document. The content type of the Atom entry document must be application/atom+xml.
Output
None.Returned HTTP headers
HTTP/1.1 200 OK
Indicates that the topic or reply was successfully moderated. If an error occurs, this header contains one of the error codes.
- HTTP/1.1 400 Bad Request
- HTTP/1.1 401 Unauthorized
- HTTP/1.1 403 Forbidden. Returned when the current user is authorized to the use the API, but cannot moderate the specified content.
- HTTP/1.1 404 Not Found. Indicates that the content is no longer available.
Example
Request:
> POST /forums/atom/review/actions HTTP/1.1 > Authorization: Basic xxx > Host: enterprise.example.com > Accept: */* > Content-Type: application/atom+xml > Content-Length: 509Response:
< HTTP/1.1 200 OK
Parent topic
Work with flagged forum topics and repliesRelated reference
Moderation action entry content