# Watchers

Who watches a task and gets its notifications.

## List a task's watchers

`GET /orgs/{org}/tasks/{task}/watchers`

Scope: `tasks:read`

Who watches the task, with whether you do. Needs View watchers (or Manage watchers) in the task's project; the whole list comes in one page.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `task` (string, required): The task's id or key (WEB-12). [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/tasks/{task}/watchers" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
      "name": "Priya Shah",
      "guest": false
    }
  ],
  "next_cursor": null,
  "watching": true,
  "can_manage": true
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Watch a task, or add a watcher

`POST /orgs/{org}/tasks/{task}/watchers`

Scope: `tasks:write`

Without person, the token's person watches the task. With person (an id or an email), that person is added; that needs Manage watchers, and the person must be able to open the task. Watching twice is no change.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `task` (string, required): The task's id or key (WEB-12). [1 to 60 characters]

### Body

- `person` (string): A person's id or email; leave out (or me) for yourself. [1 to 320 characters]

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/tasks/{task}/watchers" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "person": "string"
}'
```

### Answer: 204

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 409 `archived`: archived: The item (or its project) is archived, so it can't be changed. conflict: The thing changed since it was read, or the change clashes with its state.
- 413 `too_large`: too_large: The body or a file is larger than allowed.
- 415 `unsupported_media_type`: unsupported_media_type: The body isn't JSON.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Stop watching, or remove a watcher

`DELETE /orgs/{org}/tasks/{task}/watchers/{person}`

Scope: `tasks:write`

person is me, an id or an email. Removing someone else needs Manage watchers. A person who wasn't watching is no change.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `task` (string, required): The task's id or key (WEB-12). [1 to 60 characters]
- `person` (string, required): me, or a person's id or email. [1 to 320 characters]

### Request

```sh
curl -X DELETE "https://projqo.example/api/v1/orgs/{org}/tasks/{task}/watchers/{person}" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 204

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).
