POST/{resource}/{resourceId}/comments.json

Creating a Comment

Create a comment related to a task/message/notebook etc.

Creates a new comment, associated with the particular resource. When named in the URL, it can be either posts, tasks, milestones, notebooks, links or fileversions.

Checkout our Teamwork.com code sample repo on GitHub for a create a comment on a task code sample

resource

Options for resource are: links, milestones, files, notebooks or tasks

resource_id:

Id of the links, milestones, files, notebooks or tasks

Notes

Paging

Passing in "page" and "pageSize": eg. GET /tasks/7/comments.json?page=2&pageSize=50.

The following headers are returned:

  • X-Records - The total number of replies
  • X-Pages - The total number of pages
  • X-Page - The page you requested

Content Type

By default comments are created as plain text. To create a HTML comment, pass "content-type":"html" and put your HTML formatted content in the "body" field Post as another user You can pass "author-id" as a numeric userId to post the comment as another user if you are an administrator.

Important Note:

  • When returned comments on a file, the returned commentable_type field is file but the commentable-id field relates to the File Version ID.

  • When creating a comment on a file, the {resource} is fileversions and the {resourceId} is the File Version ID. The notify parameter is set to "" in the example below so no one will be notified of your new comment. This parameter can be set to true to send an email to anyone assigned to the task or following it. This parameter can be set to all to send an email to on the project. You can also use a list of Teamwork User IDs to only notify certain people, but you can't notify yourself.


Path Params

  • Name
    resource
    Type
    string
    required
    Description
  • Name
    resourceId
    Type
    string
    required
    Description

Body Params

    • Name
      comment
      Type
      object

    Responses

    • Code
      201
      Type
      object
      Schema
      Description
      201 Response

    Examples

    201 Response

    application/json
    {
      "id": "10001",
      "STATUS": "OK"
    }