evaluate

Perform evaluations

evaluate#evaluate

Evaluate arbitrary rego

Request
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Amet omnis cupiditate cum.
Request Body schema: application/json
required
input
required
string <binary>

Input to evaluate

rego
required
string non-empty

Arbitrary rego to be evaluated

Responses
200

OK response.

400

PolicySetNotFound: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

post/pm/api/v1/evaluate
Request samples
application/json
{
  • "input": {
    },
  • "rego": "package test\ndeny[\"should say hello world\"] {input.message != \"world\"}"
}
Response samples
application/json
{
  • "deny_messages": [
    ],
  • "error": "policy.rego:25: rego_parse_error: non-terminated string m == \"test",
  • "output": "{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}",
  • "policy": {
    },
  • "status": "error"
}