This resource represents Teams and Users that belong to Code Reviews as watchers. Watchers receive email notifications for Code Review’s Events.
We are gradually phasing out XML support from our API and this is one of the first resources that are provided only in JSON format. The format was also a bit adjusted compared to other resources: associated objects (like repositories and users) are now embedded into JSON itself, and there are no JSON root elements anymore.
id | integer | User ID or Team ID, depending on type attribute. |
---|---|---|
type | string | Can be User or Team. |
name | string | User name or Team name, depending on type attribute. |
login | string | User login. For User type only. |
string | User email address. For User type only. | |
color | string | Team’s color label. For Team type only. |
watcher_since | datetime | Date and time when the user or team was added to the Code Review as a watcher. |
GET /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers.json
Click to expand…
json http-response[
{
"id": 1,
"type": "User",
"name": "Ilya Sabanin",
"login": "ilya",
"email": "ilya@example.com",
"watcher_since": "2014/12/31 09:33:05 -0500"
}
]
POST /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/users.json
{
"user_id": 1
}
Click to expand…
json http-responseSTATUS: 201
{
"id": 1,
"type": "User",
"name": "Ilya Sabanin",
"login": "ilya",
"email": "ilya@example.com",
"watcher_since": "2014/12/31 13:19:12 -0500"
}
POST /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/teams.json
{
"team_id": 1
}
Click to expand…
json http-responseSTATUS: 201
{
"id": 1,
"type": "Team",
"name": "Developers",
"color": "white",
"watcher_since": "2014/12/31 14:56:43 -0500"
}
This method will unsubscribe User from further email notifications about this particular Code Review.
DELETE /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/users/{USER_ID}.json
Click to expand…
json http-responseSTATUS: 200
This method will unsubscribe Team from further email notifications about this particular Code Review.
DELETE /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/teams/{TEAM_ID}.json
Click to expand…
json http-responseSTATUS: 200