This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Comments in Teamwork



Overview

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 attachments, see Sample configuration.

OperationDescription
updateCommentModifies a single comment.
deleteCommentDelete a comment.
getCommentReturns a single comment identified by its id.
getRecentCommentsRetrieves recent comments.

Operation details

This section provides further details on the operations related to discussions.

Updating a comment

The updateComment operation updates a comment.

updateComment
<teamwork.updateComment>
    <commentId>{$ctx:commentId}</commentId>
    <commentBody>{$ctx:commentBody}</commentBody>
    <notify>{$ctx:notify}</notify>
    <isPrivate>{$ctx:isPrivate}</isPrivate>
	<pendingFileAttachments>{$ctx:pendingFileAttachments}</pendingFileAttachments>
</teamwork.updateComment>
Properties
  • commentId: The id of the comment.
  • commentBody: The body of the comment.
  • notify: The notify ids of the comment.
  • isPrivate:The private status of the comment.
  • pendingFileAttachments: The pending file attachments of the comment.
Sample Request

Following is a sample REST/JSON request that can be handled by the updateComment operation.

Sample request for updateComment
{
  "apiUrl":"https://wso2test.teamwork.com/",
  "apiKey":"clark42ceiling",
  "commentId": "979496",
  "commentBody": "Hello",
  "notify":"149146",
  "isPrivate": "true",
  "pendingFileAttachments": "tf_BC11BCB2-EFF5-D020-0457C3EDDD3B0491"
}
Related Teamwork documentation

http://developer.teamwork.com/comments#updating_a_commen

Deleting a comment

The deleteComment operation deletes a comment.

deleteComment
<teamwork.deleteComment>
	<commentId>{$ctx:commentId}</commentId>
</teamwork.deleteComment>
Properties
  • commentId: The id of the comment.
Sample Request

Following is a sample REST/JSON request that can be handled by the deleteComment operation.

Sample request for deleteComment
{
  "apiUrl":"https://wso2test.teamwork.com/",
  "apiKey":"clark42ceiling",
  "commentId": "979496"
}
Related Teamwork documentation

http://developer.teamwork.com/comments#destroying_a_comm

Retrieving a comment

The getComment operation retrieves the comment of given id.

getComment
<teamwork.getComment>
	<commentId>{$ctx:commentId}</commentId>
</teamwork.getComment>
Properties
  • commentId: The id of the comment.
Sample Request

Following is a sample REST/JSON request that can be handled by the getComment operation.

Sample request for getComment
{
  "apiUrl":"https://wso2test.teamwork.com/",
  "apiKey":"clark42ceiling",
  "commentId": "979496"
}
Related Teamwork documentation

http://developer.teamwork.com/comments#retrieving_a_spec

Retrieving the recent comments

The getRecentComments operation retrieves the recent comments.

getRecentComments
<teamwork.getRecentComments>
    <resource>{$ctx:resource}</resource>
    <resourceId>{$ctx:resourceId}</resourceId>
    <page>{$ctx:page}</page>
	<pageSize>{$ctx:pageSize}</pageSize>
</teamwork.getRecentComments>
Properties
  • resource: The resource  associated with the comment(posts, tasks, milestones, notebooks, links or file versions).
  • resourceId: The id of the resource.
  • page: The page no.
  • pageSize: The number of records in a page.
Sample Request

Following is a sample REST/JSON request that can be handled by the getRecentComments operation.

Sample request for getRecentComments
{
  "apiUrl":"https://wso2test.teamwork.com/",
  "apiKey":"clark42ceiling",
  "resource":"tasks",
  "resourceId": "1915325",
  "page": "1",
  "pageSize":"25"
}
Related Teamwork documentation

http://developer.teamwork.com/comments#retreiving_recent

Sample configuration

Following is a sample proxy service that illustrates how to connect to Teamwork with the init operation and use the getRecentComments operation. The sample request for this proxy can be found in getRecentComments sample request. You can use this sample as a template for using other operations in this category.

Sample proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tw_getRecentComments"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <target>
      <inSequence>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="apiKey" expression="json-eval($.apiKey)"/>
         <property name="resource" expression="json-eval($.resource)"/>
         <property name="resourceId" expression="json-eval($.resourceId)"/>
         <property name="page" expression="json-eval($.page)"/>
         <property name="pageSize" expression="json-eval($.pageSize)"/>
         <teamwork.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiKey>{$ctx:apiKey}</apiKey>
         </teamwork.init>
         <teamwork.getRecentComments>
            <resource>{$ctx:resource}</resource>
            <resourceId>{$ctx:resourceId}</resourceId>
            <page>{$ctx:page}</page>
            <pageSize>{$ctx:pageSize}</pageSize>
         </teamwork.getRecentComments>
         <respond/>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
</proxy>