Helix Swarm Guide (2019.1)

Changes : API controller providing a service for changes

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.

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.

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

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" \
     -X POST \
     "https://my-swarm-host/api/v9/changes/42/check?type=enforced"

JSON Response:

{
  "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" \
     -X POST \
     "https://my-swarm-host/api/v9/changes/42/check?type=enforced"

JSON Response:

{
  "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" \
     -X POST \
     "https://my-swarm-host/api/v9/changes/42/check?type=strict"

JSON Response:

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