Community articleActing on a blog post that is awaiting approval
Added by IBM contributorIBM on March 21, 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 post 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 post 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 the moderator can take action on a postings awaiting approval.

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

To take action on a post awaiting approval, complete the following steps:


approve
Approves the posting and publishes it to the blog.
reject
Rejects the request for publication and does not publish the posting to the blog.
Include a link element that identifies the posting you want to take action on. In the href attribute of the link element, include the web address from the history link that you made a note of in Step 3.
1. Retrieve the moderation service document. See Retrieving the Blogs moderation service document for more details.
2. In the service document, locate the workspace with the <atom:category term="entries-moderation" .../> child element, and then 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 history link of the posting that you want to take action on by getting a list of the entries awaiting approval. See Getting a list of entries that require action for more details. Make a note of the href attribute of the <link> element with the rel="http://www.ibm.com/xmlns/prod/sn/history" attribute for the entry representing the posting.
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

Provide a moderation action Atom entry document. The content type of the Atom entry document must be application/atom+xml.

Output

None.
Input
Method URI Description
POST /blogs/roller-ui/rendering/api/{homepage}/api/actions/approval/entries Value of the href attribute of the <collection> element that has a <atom:category term="approval-action" .../> child element in the moderation service document.
Content Type: application/atom+xml
Sample Request:
<?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>

	<link rel="related" href="http://enterprise.example.com/blogs/home/api/

	actions/approval/entries/fe2f3fd4-3dde-493c-a1db-111aea51174d" />

	<snx:moderation action="approve" />

	<content>This content of this entry is not objectionable according to

	company guidelines.</content>

	</entry>
Name Type Optional Description
homepage
string No {homepage} represents the blog handle of the blog configured to be the home page of the Blogs application. The handle is defined when the home page blog is created by the administrator.
Output
Code Description
200
Indicates that the entry was successfully moderated. If an error occurs, this header contains one of the error codes.
400
Bad Request.
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
403
Forbidden. The server refuses to fulfill a request, typically because the request was for an object that you don't have permission to access.
404
Not Found.
Examples
> POST /blogs/home/api/actions/approval/entries HTTP/1.1

	> Authorization: Basic xxx

	> Host: enterprise.example.com

	> Accept: */*

	> Content-Type: application/atom+xml

	> Content-Length: 509


Response returned by the server
< HTTP/1.1 200 OK

	< Date: Tue, 03 Aug 2010 20:18:51 GMT

	< Server: IBM_HTTP_Server

	...

	< Content-Length: 0

	< Content-Type: text/plain

	< Content-Language: en-US