Beanstalk

Code Review Watcher Resource

This resource represents Teams and Users that belong to Code Reviews as watchers. Watchers receive email notifications for Code Review’s Events.

New format

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.

Attributes

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.
email 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.

Find All Watchers for Code Review

json http-request
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"
  }
]

Add User Watcher to Code Review

json http-request
POST /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/users.json

{
  "user_id": 1
}

Click to expand…

json http-response
STATUS: 201

{
  "id": 1,
  "type": "User",
  "name": "Ilya Sabanin",
  "login": "ilya",
  "email": "ilya@example.com",
  "watcher_since": "2014/12/31 13:19:12 -0500"
}

Add Team Watcher to Code Review

json http-request
POST /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/teams.json

{
  "team_id": 1
}

Click to expand…

json http-response
STATUS: 201

{
  "id": 1,
  "type": "Team",
  "name": "Developers",
  "color": "white",
  "watcher_since": "2014/12/31 14:56:43 -0500"
}

Remove User Watcher from Code Review

This method will unsubscribe User from further email notifications about this particular Code Review.

json http-request
DELETE /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/users/{USER_ID}.json

Click to expand…

json http-response
STATUS: 200

Remove Team Watcher from Code Review

This method will unsubscribe Team from further email notifications about this particular Code Review.

json http-request
DELETE /api/{REPOSITORY_ID}/code_reviews/{REVIEW_ID}/watchers/teams/{TEAM_ID}.json

Click to expand…

json http-response
STATUS: 200