Solution: How to retrieve comments from a Task?

Often you need to retrieve comments from a task.
Here is a jython snipped to do that (for the current task, but with TaskApi you can search for tasks etc)
# get current task
taskId =
# set a comment for testing
taskApi.commentTask(taskId, ‘test’)
# save the comment and task changes
# get all comments from the task: result is a Array List type in jython
myComments = task.comments
# iterate over the list (in case you have many comments
for aComment in myComments:
# print the object ID (internal unique identifier like you have for all release objects
print type(aComment)
# print the individual text from the comment, there is also date and author available
print aComment.text

Where is this documented:!/xl-release/22.1.x//service/com.xebialabs.xlrelease.api.v1.TaskApi#TaskApi-commentTask-String-String

and for the attributes, best place to look for is in the DSL API: