Community articleCreating a comment
Added by IBM contributorIBM on June 12, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Create a comment programmatically.



Create a comment programmatically.

See Authenticating requests for information about how to authenticate the request.
  • {userid} is the value of the <snx:userid> of the person who owns the file. See Searching Profiles for information about how to determine a person's user ID.
  • {document-id} is the value of the <td:uuid> or <td:label> of the file and can be found in the file's Atom document. If you specify the document by label, you must also provide the identifier=label parameter as part of the request.

You can use this input parameter with the POST request.

Input

You can provide the comment as an Atom entry document or as plain text in the request header.

  • To add the comment using an Atom entry document, provide the following input:
    • Content-Type: application/atom+xml
    • Content-Length: <length-of-xml-message/>
    • Request body: atom entry element
  • To add the comment using plain text, provide the following input:
    • Content-Type: text/plain
    • Content-Length: <length-of-request-body/>
    • Request body: the comment in plain text

Output

A comment Atom entry document that includes the unique identifier of the comment and URLs to retrieve the comment.
Input
Method URI Description
POST /files/basic/api/userlibrary/{userid}/document/{document-id}/feed Adds a comment to the specified file.
Content Type: application/atom+xml
Sample Request:
<?xml version="1.0" encoding="UTF-8"?>

<entry 

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

 xmlns:app="http://www.w3.org/2007/app" 

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

<category scheme="tag:ibm.com,2006:td/type" term="comment" label="comment"/>

<content type="text">Text of comment</content>

</entry>
Name Type Optional Description
userid
string Yes {userid} is the value of the <snx:userid> of the person who owns the file. See Searching Profiles for information about how to determine a person's user ID.
document-id
string No {document-id} is the value of the <td:uuid> or <td:label> of the file and can be found in the file's Atom document. If you specify the document by label, you must also provide the identifier=label parameter as part of the request.
Name Type Optional Description
identifier
string Yes Indicates how the document is identified in the {document-id} variable segment of the web address. By default, look up is performed with the expectation that the URL contains the value from the <td:uuid> element of a File Atom entry. Specify "label" if the URL instead contains the value from the <td:label> element of a File Atom entry.
Output
Content Type: application/atom+xml
Code Description
201
Indicates that the comment entry was successfully created. If an error occurs, this header contains one of the error codes.
401
Unauthorized.
404
Not Found. Can occur if you specify the document ID using the document label, but do not provide the identifier parameter to indicate that you are using the label as the identifier.