Comments
Some of this information is duplicated from the Discussions API document.
Comment Listing
Comment listings are returned as an element of a single discussion.
> curl -H "Accept: application/vnd.tender-v1+json" "https://USER:PASS@api.tenderapp.com/help/discussions/12345"
{
"title": "Ave response time metrics",
(irrelevant fields about discussion removed)
"comments": [
{
"author_name": "Customer",
"author_email": "customer@company.com",
"body": "Hello",
"resolution": false,
"number": 1,
"via": "web",
"user_is_supporter": false,
"user_ip": "127.0.0.1",
"user_agent": "Safari...",
"referrer": "http://whatever",
"skip_spam": true,
"user_id": 54321,
"formatted_body": "<div><p>Hello</p></div>",
"html_href": "https://help.tenderapp.com/discussions/problems/1259",
"user_href": "https://api.tenderapp.com/help/users/15117",
"created_at": "2009-07-28T12:26:55Z",
"assets": [
{
"via": "comment",
"width": 480,
"height": 640,
"size": 100000,
"filename": "foobar.jpg",
"content_type": "image/jpeg",
"download_path": "/assets/5145e72ff7db2ff3242525ba4353453409a30df9/foobar.jpg",
"created_at": "2009-07-28T12:26:55Z"
}
],
},
{COMMENT}, etc
]
}
Comment Attributes
- author_name - Shows the comment author name, regardless if the comment was posted by a regular or anonymous user.
- author_email - Shows the comment author email, regardless if the comment was posted by a regular or anonymous user.
- body - The original comment body.
- skip_spam (supporter only) - skips spam checking.
- user_ip - The IP of the author posting the comment. This is very useful for spam checking.
- user_agent - The user agent of the author posting the comment. This is typically either the browser or the name of the HTTP client library that is accessing the API. This is very useful for spam checking.
- referrer - The HTTP referrer of the author posting the comment. This is very useful for spam checking.
- formatted_body (readonly) - The comment body after going through the Tender HTML formatter.
- number (readonly) - The unique number of this comment in the current discussion.
- resolution (readonly) - boolean specifying
whether this comment was posted as a resolution to the
discussion.
- user_is_supporter (readonly) boolean specifying that the user was a supporter at the time the comment was posted.
- internal Comment is an internal reply. Only available to support users.
- system_message System comment (e.g. watcher was added)
- assets - The list of asset files (uploads/attachments) associated with the comment.
Spam Checking
If your Tender site has spam checking enabled, all API requests
will be checked through the 3rd-party antispam service. It is
recommended that you pass the user_ip
,
user_agent
, and referrer
fields if
possible. For instance, if you are posting to the API from a web
contact form, you should use the user's IP, user agent, and
referrer from their contact form request.
Supporters can also pass a skip_spam
attribute to
skip spam checking for just that one comment.
Creating a Comment
You can POST to the comments action. If the user is not a support user, the comment is always posted as that user. (Remember to include the content-type!)
> curl -H "Accept: application/vnd.tender-v1+json" \
-H "Content-Type: application/json" \
-d '{"body":"I like mittens","skip_spam":true }'
"https://EMAIL:PASS@api.tenderapp.com/lightboxapp/discussions/12345/comments"
> curl -H "Accept: application/vnd.tender-v1+json" \
-H "Content-Type: application/json" \
-d '{"body":"This user has a balance of $0.25","skip_spam":true, "internal":true, "author_email":"bot@mysite.com", "author_name":"Billing Bot" }'
"https://EMAIL:PASS@api.tenderapp.com/lightboxapp/discussions/12345/comments"