Community articleUpdating a stand-alone forum reply programmatically
Added by IBM contributorIBM on June 18, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

To update a reply to a topic in a stand-alone forum, send an updated forum reply document in Atom format to the existing reply's edit web address.



To update a reply to a topic in a stand-alone forum, send an updated forum reply document in Atom format to the existing reply's edit web address.

All existing forum reply entry metadata will be replaced with the new data. To avoid deleting all existing data, retrieve any data you want to retain first, and send it back with this request. See Retrieving forum replies for more information. If you want to delete a reply and provide a customized message about why the reply was removed, send this request without first retrieving the reply data and include a <category scheme="http://www.ibm.com/xmlns/prod/sn/flags term="deleted"> element in the entry content. See Deleting forum replies for more information.

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

If you want to accept this reply as an answer to a question topic, add the <category scheme="http://www.ibm.com/xmlns/prod/sn/flags" term="answer"/> element to the reply entry document that you pass in as input.

If you want to decline this reply as an answer to a question topic, remove the <category scheme="http://www.ibm.com/xmlns/prod/sn/flags" term="answer"/> element from the reply entry document that you pass in as input.

To add an attachment to a reply entry without any, send the modified entry document with an attachment using a multipart PUT request. On a successful PUT, metadata for the attachment will be added to the entry. For example:

<snx:field name="resume" fid="id of the attached file node" ...>
<link href="link to the attachment" />
</snx:field>


To update a reply entry that already has file attachments, send the modified entry document with an attachment using a multipart PUT request. On a successful PUT, metadata for the attachment will be added to the entry. For example:

<snx:field name="resume" fid="id of the attached file node" ...>
<link href="link to the attachment" />
</snx:field>


Any file snx:fields that you want to keep must be present in the entry document. Otherwise, they will be removed from the entry.

To remove an attachment, remove the snx:field for the file from the reply entry document's metadata, and then send a PUT request.
Input
Method URI Description
PUT /forums/atom/reply Value of the href attribute of <link rel=edit"> element of each entry in the forum replies feed.
Content Type: application/atom+xml
Name Type Optional Description
replyUuid
string No The UUID of the reply you wish to update.
Name Type Optional Description
X-LConn-RunAs
string Yes The value should be in such format: userid=<user ext id>,username=<user name>,useremail=<user mail> . This header enables impersonation and must works with Forums admin user to authenticate request. If the user does not exists, an inactive user will be created with specified userid , username and usermail. If the user exists, username and useremail can be omitted. eg:userid=BFB5FDCB-B0E2-408A-A351-09103D8D5527,username=xxxxxx,useremail=xxxx@cn.ibm.com
Output
Code Description
200
OK. Indicates that the forum reply was successfully updated. If an error occurs, this header contains one of the error codes.
401
Unauthorized.
404
Not Found.
Examples
PUT /forums/atom/topic?topicUuid=84139b22-17f0-4290-939b-73370c6ef17c HTTP/1.1

Host: www.dulcinea.com

Content-Type: application/atom+xml

Authorization: xxx

Content-Length: nnn

 

<entry xmlns="http://www.w3.org/2005/Atom">

    <id>urn:lsid:ibm.com:forum:84139b22-17f0-4290-939b-73370c6ef17c</id>

    <title type="text">Test topic 1</title>

    <published>2010-08-04T21:45:09.324Z</published>

    <updated>2010-08-04T21:45:09.324Z</updated>

    <author>

      <email>jdoe@literature.com</email>

      <name>Jane Doe</name>

      <snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">

       772A006E-0A01-8703-8525-7346003DAFD6

      </snx:userid>

      <snx:userState xmlns:snx="http://www.ibm.com/xmlns/prod/sn">active</snx:userState>

    </author>

    <link 

     href="https://www.dulcinea.com/forums/atom/topic?topicUuid=84139b22-17f0-4290-939b-73370c6ef17c" 

     rel="self" 

     type="application/atom+xml">

    </link>

    <link 

     href="https://www.dulcinea.com/forums/atom/topic?topicUuid=84139b22-17f0-4290-939b-73370c6ef17c" 

     rel="edit" 

     type="application/atom+xml">

    </link>

    <category term="forum-topic" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>

    <category term="bb"></category>

    <category term="aa"></category>

    <link 

     href="https://www.dulcinea.com/forums/html/topic?id=84139b22-17f0-4290-939b-73370c6ef17c" 

     rel="alternate" 

     type="text/html">

    </link>

    <link 

     xmlns:thr="http://purl.org/syndication/thread/1.0" 

     href="https://www.dulcinea.com/forums/atom/replies?topicUuid=84139b22-17f0-4290-939b-73370c6ef17c" 

     rel="replies" 

     type="application/atom+xml" 

     thr:count="0">

    </link>

    <thr:in-reply-to 

     xmlns:thr="http://purl.org/syndication/thread/1.0" 

     href="https://www.dulcinea.com/forums/atom/topics?forumUuid=e1b8faff-afc7-4ba8-9269-05bfd592efc7" 

     ref="urn:lsid:ibm.com:forum:e1b8faff-afc7-4ba8-9269-05bfd592efc7" 

     type="application/atom+xml">

    </thr:in-reply-to>

    <content type="html">updated topic test</content>

    <snx:permissions 

     xmlns:snx="http://www.ibm.com/xmlns/prod/sn">none, create_forum, view_forum, edit_forum, del_forum, 

      create_post, edit_personal_post, edit_all_post, del_personal_post, del_all_post, pin_topic, subscribe, 

      lock_node, add_member, delete_member, create_topictag, del_all_topictag, del_personal_topictag, 

      create_forumtag, del_all_forumtag, del_personal_forumtag, view_category, edit_personal_question, 

      edit_all_question

    </snx:permissions>

</entry>


Response returned by the server
HTTP/1.1 200 OK