...
...
The following operations allow you to work with comments. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with comments, see Sample configuration.
This section provides details on each of the operations.
Anchor |
---|
| createComment |
---|
| createComment |
---|
|
Creating a commentThe createComment
operation allows a user to add a comment to a specific file or comment as a reply comment.
Code Block |
---|
language | html/xml |
---|
title | createComment |
---|
|
<box.createComment>
<itemType>{$ctx:itemType}</itemType>
<itemId>{$ctx:itemId}</itemId>
<message>{$ctx:message}</message>
</box.createComment> |
itemType:
Required - The type of the item that this comment will be placed on. It can be a file or a comment.itemId:
Required - The ID of the item that this comment will be placed on.message:
Required - The text body of the comment.
Sample requestFollowing is a sample REST request that can be handled by the createComment
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for createComment |
---|
|
{
"apiUrl":"https://api.box.com",
"accessToken":"Q3ajlCrUEgkwC6le9rpddffsXaRxndfgAK79dSSz",
"itemType":"file",
"itemId":"16806754267",
"message":"Tested"
} |
http://developers.box.com/docs/#comments-add-a-comment-to-an-item
Anchor |
---|
| deleteComment |
---|
| deleteComment |
---|
|
Deleting a commentThe deleteComment
operation permanently deletes a comment.
Code Block |
---|
language | html/xml |
---|
title | deleteComment |
---|
|
<box.deleteComment>
<commentId>{$ctx:commentId}</commentId>
</box.deleteComment> |
commentId
: The ID of the comment to delete.
Following is a sample REST request that can be handled by the deleteComment
operation.
Code Block |
---|
language | html/xml |
---|
title | Sample Request for deleteComment |
---|
|
{
"apiUrl":"https://api.box.com",
"accessToken":"iItGu0aVqL6qyR2dfgTdfwr9dn7RCTLU7iXxDx",
"commentId":"31678149"
} |
http://developers.box.com/docs/#comments-delete-a-comment
Retrieving comment detailsThe getComment
operation is used to retrieve the messages and metadata about a specific comment. It also includes information on the user who created a comment.
Code Block |
---|
language | html/xml |
---|
title | getComment |
---|
|
<box.getComment>
<commentId>{$ctx:commentId}</commentId>
</box.getComment> |
commentId:
ID of the comment.
Following is a sample REST request that can be handled by the getComment
operation.
Code Block |
---|
language | html/xml |
---|
title | Sample Request for getComment |
---|
|
{
"apiUrl":"https://api.box.com",
"accessToken":"iItGu0aVqL6qyR2Twrsfdgdf9n7RCTLU7iXxDx",
"commentId":"31678149"
} |
http://developers.box.com/docs/#comments-get-information-about-a-comment
Anchor |
---|
| updateComment |
---|
| updateComment |
---|
|
Updating a commentThe updateComment
operation allows you to update the message of a comment.
Code Block |
---|
language | html/xml |
---|
title | updateComment |
---|
|
<box.updateComment>
<message>{$ctx:message}</message>
<commentId>{$ctx:commentId}</commentId>
</box.updateComment> |
message:
Required - The text for the comment message.commentId:
ID of the comment.
Following is a sample REST request that can be handled by the updateComment
operation.
Code Block |
---|
language | html/xml |
---|
title | Sample Request for updateComment |
---|
|
{
"apiUrl":"https://api.box.com",
"accessToken":"G0P4x7Ky6aJF3df8lbdfdfgL0QADJBZbcTs6b1f",
"commentId":"31678149",
"message":"Updated via ESB"
} |
http://developers.box.com/docs/#comments-change-a-comments-message
Following is a sample proxy service that illustrates how to connect to Box with the init
operation and use the createComment
operation to list the changes the user made. The sample request for this proxy can be found in createComment sample request. You can use this sample as a template for using other operations in this category.
Code Block |
---|
language | html/xml |
---|
title | Sample Proxy |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="box_createComment"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence onError="faultHandlerSeq">
<property name="apiUrl" expression="json-eval($.apiUrl)"/>
<property name="accessToken" expression="json-eval($.accessToken)"/>
<property name="fields" expression="json-eval($.fields)"/>
<property name="itemType" expression="json-eval($.itemType)"/>
<property name="itemId" expression="json-eval($.itemId)"/>
<property name="message" expression="json-eval($.message)"/>
<box.init>
<accessToken>{$ctx:accessToken}</accessToken>
<apiUrl>{$ctx:apiUrl}</apiUrl>
<fields>{$ctx:fields}</fields>
</box.init>
<box.createComment>
<itemType>{$ctx:itemType}</itemType>
<itemId>{$ctx:itemId}</itemId>
<message>{$ctx:message}</message>
</box.createComment>
<property name="messageType" value="application/json" scope="axis2"/>
<filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]">
<then>
<property name="ERROR_CODE" expression="$axis2:HTTP_SC"/>
<switch source="$axis2:HTTP_SC">
<case regex="401">
<property name="ERROR_MESSAGE" value="Unauthorized"/>
<property name="error_description" expression="json-eval($.message)"/>
<sequence key="faultHandlerSeq"/>
</case>
</switch>
</then>
</filter>
<respond/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy> |