Skip to main content

Source Control Evaluation REST API

The Source Control Evaluation REST API provides a way to perform an application policy evaluation on supported manifest files discovered in a source control branch.

Source control evaluations are executed asynchronously and it is thus a 2-step process for the API user to obtain the results:

Request a Source Control Evaluation

To request a source control evaluation, you need the ID of the application associated with the source control repository, the name of the target branch in the source control repository and the ID of the target stage. For source control evaluations on feature branches the target stage is usually "develop". For source control evaluations on the default branch the "source" stage is more appropriate. Other stage IDs that can be used in either case, but not recommended, are "build", "stage-release", "release", "operate".

By default, the evaluation is done for the whole repository. If only part(s) of the repository should be evaluated, the optional scanTargets attribute can be used to specify one or more paths inside the repository. These paths cannot contain "../" or "..\".

POST /api/v2/evaluation/applications/{applicationInternalId}/sourceControlEvaluation

with a JSON body:

{
        "stageId": "develop",
        "branchName": "my-test-branch-name",
        "scanTargets": ["path-inside-repository1", "path-inside-repository2"]
}

Example using the cURL tool:

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{"stageId":"develop","branchName":"my-test-branch-name"}' 'http://localhost:8070/api/v2/evaluation/applications/cb748fb6ff8f4251b40b63edf1cc465c/sourceControlEvaluation'

which will result in a JSON response like this:

{
        "statusUrl": "api/v2/evaluation/applications/cb748fb6ff8f4251b40b63edf1cc465c/status/accc369749774924baa1d207494c29e1"
}

Check the Status of a Source Control Evaluation Request

The status URL returned above can be used to check the evaluation status:

GET api/v2/evaluation/applications/{applicationInternalId}/status/{statusId}

Example using the cURL tool:

curl -u admin:admin123 'http://localhost:8070/api/v2/evaluation/applications/cb748fb6ff8f4251b40b63edf1cc465c/status/accc369749774924baa1d207494c29e1'

The response will include one of three possible status values:

  • "PENDING"

  • "FAILED"

  • "COMPLETED"

For example, if the evaluation is still in progress:

{
        "status": "PENDING"
}

or, in the rare case of an error that causes the evaluation to fail:

{
        "status": "FAILED",
        "reason": "message"
}

or, finally, if the evaluation is successful links to the evaluation report are provided:

{
        "status": "COMPLETED",
        "reportHtmlUrl": "ui/links/application/cb748fb6ff8f4251b40b63edf1cc465c/report/affdb6b964a64f0bad2db7170c7560dc",
        "embeddableReportHtmlUrl": "ui/links/application/cb748fb6ff8f4251b40b63edf1cc465c/report/affdb6b964a64f0bad2db7170c7560dc/embeddable",
        "reportPdfUrl": "ui/links/application/cb748fb6ff8f4251b40b63edf1cc465c/report/affdb6b964a64f0bad2db7170c7560dc/pdf",
        "reportDataUrl": "api/v2/applications/cb748fb6ff8f4251b40b63edf1cc465c/reports/affdb6b964a64f0bad2db7170c7560dc"
}