Comments
October 31, 2014 ยท View on GitHub
HATERS GONNA HATE
Get comments
Comments are included on the topics directly. So to see all comments for a message, you'd just GET that message and they're included and look like this:
{
"comments": [
{
"id": 1028592764,
"content": "Yeah, really, welcome!",
"created_at": "2012-03-22T16:56:48-05:00",
"updated_at": "2012-03-22T16:56:48-05:00",
"private": false,
"trashed": false,
"attachments":[
{
"key": "40b8a84cb1a30dbe04457dc99e094b6299deea41",
"name": "bearwave.gif",
"byte_size": 508254,
"content_type":"image/png",
"created_at":"2012-03-27T22:48:49-04:00",
"url":"https://basecamp.com/1111/api/v1/projects/2222/attachments/3333/40b8a84cb1a30dbe04457dc99e094b6299deea41/original/bearwave.gif",
"app_url":"https://basecamp.com/1111/projects/2222/attachments/3333/40b8a84cb1a30dbe04457dc99e094b6299deea41/original/bearwave.gif",
"creator":{
"id": 73,
"name": "Nick Quaranto",
"avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3",
"fullsize_avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/original.gif?r=3"
}
}
],
"creator": {
"id": 149087659,
"name": "Jason Fried",
"avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3",
"fullsize_avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/original.gif?r=3"
}
}
]
}
Create comment
POST /projects/1/<section>/1/comments.jsonwill create a new comment from the parameters passed for the commentable described via/ -- for example /projects/1/messages/1/comments.json or /projects/1/todos/1/comments.json. The subscribers array is an optional list of people IDs that you want to notify about this comment (see Get accesses on how to get the people IDs for a given project).
{
"content": "Imma let you finish, but...",
"subscribers": [1, 5, 6]
}
To "loop-in" outside email addresses for users without an account, include a new_subscriber_emails array with the parameters.
{
"subject": "Hello everyone",
"content": "This is going to be a GREAT Saturday!",
"new_subscriber_emails": ["example@example.com"]
}
This will return 201 Created, with a representation of the comment just created in the response body if the creation was a success. The topic can be accessed via the topic_url parameter. For example:
{
"id": 1028592764,
"content": "Yeah, really, welcome!",
"created_at": "2012-03-22T16:56:48-05:00",
"updated_at": "2012-03-22T16:56:48-05:00",
"private": false,
"trashed": false,
"creator": {
"id": 149087659,
"name": "Jason Fried",
"avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3",
"fullsize_avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/original.gif?r=3"
},
"topic_url": "https://basecamp.com/9999999/api/v1/messages/888888.json"
}
Attaching files
Attaching files to a comment requires both the token and the name of the attachment. The token is returned from the Create attachments endpoint, which you must hit first before creating an upload.
The name parameter must be a valid filename with an extension. Multiple
attachments are allowed.
{
"content": "Here's the stuff",
"attachments": [
{
"token": "4f71ea23-134660425d1818169ecfdbaa43cfc07f4e33ef4c",
"name": "final_mockup.png"
},
{
"token": "4f71ea23-458294fc0d87927301c5d54b69a7517602939e2c",
"name": "draft_agreement.png"
}
]
}
Delete comment
DELETE /projects/1/comments/1.jsonwill delete the comment specified and return204 No Contentif that was successful. If the user does not have access to delete the comment, you'll see403 Forbidden.
Private comments
Comments inherit the privacy of their commentables. For example, a comment on a private message is private. If a commentable is made public or private, so are all of its comments.
Attachments on a comment inherit the privacy of its commentable. If a commentable is made public or private, so are all attachments on all of its comments.