Getting comments for the entity
The request allows you to get a list of comments for an entity.
Request format
Before making a request, get permission to access the API.
To get comments, use an HTTP GET
request.
GET /v2/entities/<entity_type>/<entity_ID>/comments
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
Headers
-
Host
Address of the node that provides the API:
https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <OAuth_token>
format, e.g.:OAuth 0c4181a7c2cf4521964a72ff********
-
X-Org-ID or X-Cloud-Org-ID
Organization ID. You can find it out on the Tracker organizations page
.- If a Yandex 360 for Business organization is the only one linked to Tracker, the
X-Org-ID
header is used. - If a Yandex Cloud Organization organization is the only one linked to Tracker, the
X-Cloud-Org-ID
header is used. - If both Yandex 360 for Business and Yandex Cloud Organization organizations are linked to Tracker at the same time, the
X-Org-ID
header and the Yandex 360 for Business organization ID are used.
- If a Yandex 360 for Business organization is the only one linked to Tracker, the
Resource
Parameter | Description | Data type |
---|---|---|
<entity_type> | Entity type:
|
String |
<entity_ID> | Entity ID. To get the ID, see the entity list. | String |
<project_or_portfolio_ID> | Project or portfolio ID (the shortId value). You can use it instead of the entity ID in the request. |
String |
Warning
Entity ID is not the same as project or portfolio ID.
Request parameters
Additional parameters
Parameter | Description | Data type |
---|---|---|
expand | Additional information to be included into the response:
|
String |
Example: Getting a list of comments
- An HTTP GET method is used.
- The response displays information about all comments.
GET /v2/entities/project/<project_ID>/comments?expand=all Host: https://api.tracker.yandex.net Authorization: OAuth <OAuth_token> X-Org-ID: <organization ID>
Response format
If the request is successful, the API returns a response with code 200 OK
.
The response body contains information about entity comments in JSON format.
[
{
"self": "https://api.tracker.yandex.net/v2/entities/project/6586d6fee2b9ef74********/comments/15",
"id": 15,
"longId": "65a156a29d5d2000********",
"text": "Comment **number one.**",
"textHtml": "<p>Comment <strong>number one.</strong></p>\n",
"attachments": [
{
"self": "https://api.tracker.yandex.net/v2/entities/project/6586d6fee2b9ef74********/attachments/25",
"id": "25",
"display": "image.jpg"
}
],
"createdBy": {
"self": "https://api.tracker.yandex.net/v2/users/19********",
"id": "19********",
"display": "Full Name",
"cloudUid": "ajeppa7dgp53********",
"passportUid": "15********"
},
"updatedBy": {
"self": "https://api.tracker.yandex.net/v2/users/19********",
"id": "19********",
"display": "Full Name",
"cloudUid": "ajeppa7dgp53********",
"passportUid": "15********"
},
"createdAt": "2024-01-12T15:11:30.278+0000",
"updatedAt": "2024-01-12T16:33:35.988+0000",
"usersReacted": {
"like": [
{
"self": "https://api.tracker.yandex.net/v2/users/19********",
"id": "19********",
"display": "Full Name",
"cloudUid": "ajeppa7dgp71********",
"passportUid": "16********"
}
]
},
"ownReactions": ["like"],
"summonees": [
{
"self": "https://api.tracker.yandex.net/v2/users/19********",
"id": "19********",
"display": "Full Name",
"cloudUid": "ajeppa7dgp32********",
"passportUid": "12********"
}
],
"version": 3,
"type": "standard",
"transport": "internal"
}
]
Response parameters
Parameter | Description | Data type |
---|---|---|
self | Link to the comment object. | String |
id | Comment ID. | Number |
longId | Comment ID as a string. | String |
text | Text of the comment. | String |
textHtml | Comment HTML markup. | String |
attachments | Attached files. | String |
createdBy | Object with information about the author of the comment. | Object |
updatedBy | Object with information about the last user to have updated the comment. | Object |
createdAt | Comment creation date and time in the format:YYYY-MM-DDThh:mm:ss.sss±hhmm |
String |
updatedAt | Comment update date and time in the format:YYYY-MM-DDThh:mm:ss.sss±hhmm . |
String |
usersReacted | User reactions (present in the response if the expand parameter in the request is set to all or reactions ):
|
Object with a list of reactions and responders |
reactionsCount | Number of reactions (present in the response if the expand parameter in the request is not set to all or reactions ). |
Object with a list and number of reactions |
ownReactions | Reactions of the comment author:
|
List of strings |
summonees | IDs or usernames of invited users. | Array of objects or strings |
maillistSummonees | List of mailing lists mentioned in the comment. | Array of strings |
version | Comment version. Each update increases the comment's version number. | Number |
type | Comment type:
|
String |
transport | Method of adding a comment:
|
String |
createdBy
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the user. | String |
id | User ID. | Number |
display | Displayed user name. | String |
cloudUid | User unique ID in Yandex Cloud Organization. | String |
passportUid | Unique ID of the user account in the Yandex 360 for Business organization and Yandex ID. | String |
updatedBy
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the user. | String |
id | User ID. | Number |
display | Displayed user name. | String |
cloudUid | User unique ID in Yandex Cloud Organization. | String |
passportUid | Unique ID of the user account in the Yandex 360 for Business organization and Yandex ID. | String |
usersReacted
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the user. | String |
id | User ID. | Number |
display | Displayed user name. | String |
cloudUid | User unique ID in Yandex Cloud Organization. | String |
passportUid | Unique ID of the user account in the Yandex 360 for Business organization and Yandex ID. | String |
If the request is processed incorrectly, the API returns a response with an error code:
- 400
- One or more request parameters have an invalid value.
- 404
- The requested object was not found. You may have specified an invalid object ID or key.
- 422
- JSON validation error, the request is rejected.
Paginated display of entity comments
For paginated display of results, use an HTTP GET
request.
GET /v2/entities/<entity_type>/<entity_ID>/comments/_relative
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
Specify additional parameters in the query string:
Parameter |
Description |
Data type |
perPage |
Defines the maximum number of comments in a response. Default value is 50 |
Number |
from |
ID of the comment after which the list starts to be generated. The comment itself is not included in the list. Not used together with the |
String |
selected |
ID of the comment around which the list is generated. Not specified with the
|
String |
newCommentsOnTop |
Reverses the order of comments in the list. The default value is |
Logical |
direction |
Determines the order of comments in the list:
|
String |
If no parameters are specified, the full list of entities is displayed.
Example: Getting a list of comments
- An HTTP GET method is used.
- The response displays information about three comments starting with
65a1bdbdb02b780b31********
.GET /v2/entities/project/<project_ID>/comments/_relative?perPage=3&from=65a1bdb02b780b31******** Host: https://api.tracker.yandex.net Authorization: OAuth <OAuth_token> X-Org-ID: <organization ID>
Response format with paginated comments
If the request is successful, the API returns a response with code 200 OK
.
The response body contains information about entity comments in JSON format.
{
"comments": [
{
"self": "https://api.tracker.yandex.net/v2/entities/project/65a1bdb02b780b31********/comments/22",
"id": 22,
"longId": "65a1bdb02b780b31********",
"text": "Previous comment.",
...
},
{
"self": "https://api.tracker.yandex.net/v2/entities/project/65a1bdb02b780b32********/comments/23",
"id": 23,
"longId": "65a1bdb02b780b32********",
"text": "Specified comment.",
...
},
{
"self": "https://api.tracker.yandex.net/v2/entities/project/65a1bdb02b780b33********/comments/24",
"id": 24,
"longId": "65a1bdb02b780b33********",
"text": "Next comment.",
...
}
],
"hasNext": True,
"hasPrev": True
}
Response parameters
Parameter | Description | Data type |
---|---|---|
comments | List of comments. | List of objects |
hasNext | Indicates the presence of subsequent entries in the list. | Logical |
hasPrev | Indicates the presence of previous entries in the list. | Logical |
If the request is processed incorrectly, the API returns a response with an error code:
- 400
- One or more request parameters have an invalid value.
- 404
- The requested object was not found. You may have specified an invalid object ID or key.
- 422
- JSON validation error, the request is rejected.