Documentation | 2025.1

# Changes : API controller providing a service for changes

From Swarm 2022.2, Swarm no longer supports APIs older than v9.

## Get projects and branches affected by a given change id

### Summary

Get projects, and branches, affected by a given change id.

GET /api/v9/changes/{change}/affectsprojects

### Description

All authenticated users are able to use this API.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the Helix Core Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Example response

#### Successful Response:

    HTTP/1.1 200 OK

    {
        "change": {
            "id":"1050",
            "projects": {
                "jam": [
                    "live",
                    "main"
                ]
            }
        }
    }

## Get default reviewers for a given change id

### Summary

Get default reviewers for a given change id.

GET /api/v9/changes/{change}/defaultreviewers

### Description

All authenticated users are able to use this API.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the Helix Core Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Example response

#### Successful Response:

    HTTP/1.1 200 OK

    {
    "change": {
        "id": "1050",
        "defaultReviewers": {
            "groups": {
                "group1": {"required": "1"},
                "group2": {}
            },
            "users": {
                "user1": {},
                "user2": {"required": "true"}
            }
        }
    }
    }

## Perform checks on a change if enabled

### Summary

Performs checks on the change if enabled

GET /api/v9/changes/{id}/check

### Description

Performs checks on the change if workflow configuration requires it.

- Private projects: when a project is made private, only the project owners, moderators, and members, plus users with super-level privileges in the Helix Core Server, can see the project, its activity streams, and ongoing reviews. API responses honor these private project restrictions. For more information about private project restrictions, see Private projects.
- Permissions: if a public review contains files that the user does not have permission to view, the review is returned but the restricted files are not displayed.

### Parameters

Parameter | Description | Type | Parameter Type | Required
--- | --- | --- | --- | ---
id | Change to check | string | form | Yes
type | The type of check. Must have a value of enforced, strict or shelve | string | form | Yes

### Example response

#### Successful Response:

    HTTP/1.1 200 OK

    {
      "status":   "OK",
      "isValid":  "true",
      "messages": []
    }

### Examples of usage

#### Carry out enforced checks on a change if configured

To check change 42:

    curl -u "username:password" "https://my-swarm-host/api/v9/changes/42/check?type=enforced"

JSON Response:

    HTTP/1.1 200 OK

    {
      "status":   "OK",
      "isValid":  "true",
      "messages": []
    }

#### Carry out enforced checks on a change if configured. Example of a failed 'requires review'

To check change 42:

    curl -u "username:password" "https://my-swarm-host/api/v9/changes/42/check?type=enforced"

JSON Response:

    HTTP/1.1 200 OK

    {
      "status":   "NO_REVIEW",
      "isValid":  "false",
      "messages": ["Change [42] must be associated with a review"]
    }

#### Carry out strict checks on a change if configured

To check change 42:

    curl -u "username:password" "https://my-swarm-host/api/v9/changes/42/check?type=strict"

JSON Response:

    HTTP/1.1 200 OK

    {
      "status":   "OK",
      "isValid":  "true",
      "messages": []
    }

Your search for returned results