Every Changeset in Beanstalk can have many Comments. The API allows you to view and create them.
Beanstalk will automatically escape all HTML tags from the body attribute, apply Textile formatting and turn all URls into clickable HTML links.
repository_id is required. Either name of the repo or it’s ID can be used. Use page parameter to skim through pages. Beanstalk will send 15 comments per page.
GET /api/repo_name/comments.xml
Click to expand…
http-response<?xml version="1.0" encoding="UTF-8"?>
<comments type="array">
<comment>
<id type="integer">324934</id>
<account-id type="integer">4</account-id>
<author-id type="integer">17</author-id>
<body>
Hey, this is my first comment.
I think you have a typo on this line.
</body>
<created-at type="datetime">2010-01-18T15:47:45Z</created-at>
<file-path>trunk/index.html</file-path>
<line-number>34</line-number>
<rendered-body>
<p>Hey, this is my first comment.
I think you have a typo on this line.</p>
</rendered-body>
<repository-id type="integer">2</repository-id>
<revision type="integer">1</revision>
<updated-at type="datetime">2010-01-18T15:47:45Z</updated-at>
</comment>
<comment>
<id type="integer">834234</id>
<account-id type="integer">4</account-id>
<author-id type="integer">17</author-id>
<body>Check out my *textile* dude.</body>
<created-at type="datetime">2010-01-18T15:48:54Z</created-at>
<file-path nil="true"></file-path>
<line-number nil="true"></line-number>
<rendered-body>
<p>Check out my <strong>textile</strong> dude.</p>
</rendered-body>
<repository-id type="integer">2</repository-id>
<revision type="integer">66</revision>
<updated-at type="datetime">2010-01-18T15:48:54Z</updated-at>
</comment>
</comments>
Beanstalk::API::Comment.find :all, :params => {
:repository_id => 2
}GET /api/repo_name/comments.xml?revision=1
Click to expand…
http-response<?xml version="1.0" encoding="UTF-8"?>
<comments type="array">
<comment>
<id type="integer">583197</id>
<account-id type="integer">4</account-id>
<author-id type="integer">17</author-id>
<body>
Hey, this is my first comment.
I think you have a typo on this line.
</body>
<created-at type="datetime">2010-01-18T15:47:45Z</created-at>
<file-path>trunk/index.html</file-path>
<line-number>34</line-number>
<rendered-body>
<p>Hey, this is my first comment.
I think you have a typo on this line.</p>
</rendered-body>
<repository-id type="integer">2</repository-id>
<revision type="integer">1</revision>
<updated-at type="datetime">2010-01-18T15:47:45Z</updated-at>
</comment>
</comments>
Beanstalk::API::Comment.find :all, :params => {
:repository_id => 2,
:revision => 1
}GET /api/repo_name/comments/8543.xml
Click to expand…
http-response<?xml version="1.0" encoding="UTF-8"?>
<comment>
<id type="integer">8543</id>
<account-id type="integer">4</account-id>
<author-id type="integer">17</author-id>
<body>Hey, this is my first comment.</body>
<created-at type="datetime">2010-01-18T15:47:45Z</created-at>
<file-path>trunk/index.html</file-path>
<line-number>34</line-number>
<rendered-body>
<p>Hey, this is my first comment.</p>
</rendered-body>
<repository-id type="integer">2</repository-id>
<revision type="integer">1</revision>
<updated-at type="datetime">2010-01-18T15:47:45Z</updated-at>
</comment>
Beanstalk::API::Comment.find 8543, :params => {
:repository_id => 2
}POST /api/repo_name/comments.xml
<comment>
<revision type="integer">6</revision>
<body>This is my comment text.</body>
<file-path>/branches/application/super_file.txt</file-path>
<line-number>4</line-number>
</comment>
Click to expand…
http-response<?xml version="1.0" encoding="UTF-8"?>
<comment>
<id type="integer">98636</id>
<account-id type="integer">4</account-id>
<author-id type="integer">17</author-id>
<body>This is my comment text.</body>
<created-at type="datetime">2010-01-18T15:47:45Z</created-at>
<file-path>/branches/application/super_file.txt</file-path>
<line-number>4</line-number>
<rendered-body>
<p>This is my comment text.</p>
</rendered-body>
<repository-id type="integer">2</repository-id>
<revision type="integer">6</revision>
<updated-at type="datetime">2010-01-18T15:47:45Z</updated-at>
</comment>
--OR IF INVALID--
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>Body can't be blank</error>
</errors>
c = Beanstalk::API::Comment.new
c.prefix_options = { :repository_id => 2 }
c.revision = 6
c.body = "This is my comment text."
c.file_path = "/branches/application/super_file.txt"
c.line_number = 4
c.save