Test Targets

Access and modify Scan Targets

Targets#ListTargets

List a collection of Test Targets

Request
query Parameters
accountId
required
string^[a-zA-Z0-9_-]{22}$

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
page
integer <int64> >= 0
Default: 0

Page number to fetch (starting from 0)

Example: page=4
pageSize
integer <int64> [ 1 .. 100 ]
Default: 30

Number of results per page

Example: pageSize=50
name
string

Resource name

Example: name=NodeGoat
orgId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Organization ID

Example: orgId=example_org
projectId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Project ID

Example: projectId=example_project
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Delectus quo eveniet dolor et.
Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

429

TooManyRequests: Too Many Requests response.

500

InternalServerError: Internal Server Error response.

get/sto/api/v2/targets
Request samples
Response samples
application/json
{
  • "pagination": {
    },
  • "results": [
    ]
}

Targets#CreateTarget

Create a new Test Target

Request
query Parameters
accountId
required
string^[a-zA-Z0-9_-]{22}$

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
orgId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Organization ID

Examples:
orgId=example_org
projectId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Project ID

Examples:
projectId=example_project
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Laborum illum.
Request Body schema: application/json
required
baselineRegEx
string <= 128 characters

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

baselineVariantId
string^([a-zA-Z0-9_-]{22}|)$

ID of baseline Target Variant for Issue comparison

directory
string <= 1024 characters

Directory within the Test Target to be scanned

name
required
string <= 128 characters ^[a-zA-Z0-9_.:/|()-]+$

Name of the Test Target

type
required
string

Test Target's type

Enum: "container" "repository" "instance" "configuration"
url
string <= 1024 characters

URL used to access the Test Target

Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

429

TooManyRequests: Too Many Requests response.

500

InternalServerError: Internal Server Error response.

post/sto/api/v2/targets
Request samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "directory": "app/src",
  • "name": "NodeGoat",
  • "type": "repository",
}
Response samples
application/json
{
  • "id": "abcdef1234567890ghijkl"
}

Targets#FindTargetById

Find Test Target by ID

Request
path Parameters
id
required
string^[a-zA-Z0-9_-]{22}$

The ID of the Test Target to retrieve

Example: abcdef1234567890ghijkl
query Parameters
accountId
required
string^[a-zA-Z0-9_-]{22}$

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
orgId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Organization ID

Examples:
orgId=example_org
projectId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Project ID

Examples:
projectId=example_project
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Qui harum maxime qui et repellat occaecati.
Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

429

TooManyRequests: Too Many Requests response.

500

InternalServerError: Internal Server Error response.

get/sto/api/v2/targets/{id}
Request samples
Response samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "created": 1651578240,
  • "directory": "app/src",
  • "id": "abcdef1234567890ghijkl",
  • "lastModified": 1651578240,
  • "name": "NodeGoat",
  • "orgId": "example_org",
  • "projectId": "example_project",
  • "type": "repository",
}

Targets#PatchTarget

Update only certain fields on an existing Test Target

Request
path Parameters
id
required
string^[a-zA-Z0-9_-]{22}$

The ID of the Test Target to update

Example: abcdef1234567890ghijkl
query Parameters
accountId
required
string^[a-zA-Z0-9_-]{22}$

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
orgId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Organization ID

Examples:
orgId=example_org
projectId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Project ID

Examples:
projectId=example_project
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Officia fuga esse.
Request Body schema: application/json
required
baselineRegEx
string <= 128 characters

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

baselineVariantId
string^([a-zA-Z0-9_-]{22}|)$

ID of baseline Target Variant for Issue comparison

directory
string <= 1024 characters

Directory within the Test Target to be scanned

name
string <= 128 characters ^[a-zA-Z0-9_.:/|()-]+$

Name of the Test Target

type
string

Test Target's type

Enum: "container" "repository" "instance" "configuration"
url
string <= 1024 characters

URL used to access the Test Target

Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

429

TooManyRequests: Too Many Requests response.

500

InternalServerError: Internal Server Error response.

patch/sto/api/v2/targets/{id}
Request samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "directory": "app/src",
  • "name": "NodeGoat",
  • "type": "repository",
}
Response samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "created": 1651578240,
  • "directory": "app/src",
  • "id": "abcdef1234567890ghijkl",
  • "lastModified": 1651578240,
  • "name": "NodeGoat",
  • "orgId": "example_org",
  • "projectId": "example_project",
  • "type": "repository",
}

Targets#UpdateTarget

Update an existing Test Target

Request
path Parameters
id
required
string^[a-zA-Z0-9_-]{22}$

The ID of the Test Target to update

Example: abcdef1234567890ghijkl
query Parameters
accountId
required
string^[a-zA-Z0-9_-]{22}$

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
orgId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Organization ID

Examples:
orgId=example_org
projectId
required
string <= 128 characters ^[A-Za-z_][A-Za-z0-9_]*$

Harness Project ID

Examples:
projectId=example_project
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Exercitationem similique velit molestiae odit occaecati minima.
Request Body schema: application/json
required
baselineRegEx
string <= 128 characters

RegEx to match for dynamically selecting the Baseline for this Scan Target. Must be compatible with the RE2 standard.

baselineVariantId
string^([a-zA-Z0-9_-]{22}|)$

ID of baseline Target Variant for Issue comparison

directory
string <= 1024 characters

Directory within the Test Target to be scanned

name
required
string <= 128 characters ^[a-zA-Z0-9_.:/|()-]+$

Name of the Test Target

type
required
string

Test Target's type

Enum: "container" "repository" "instance" "configuration"
url
string <= 1024 characters

URL used to access the Test Target

Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

429

TooManyRequests: Too Many Requests response.

500

InternalServerError: Internal Server Error response.

put/sto/api/v2/targets/{id}
Request samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "directory": "app/src",
  • "name": "NodeGoat",
  • "type": "repository",
}
Response samples
application/json
{
  • "baselineRegEx": "release_.*",
  • "baselineVariantId": "abcdef1234567890ghijkl",
  • "created": 1651578240,
  • "directory": "app/src",
  • "id": "abcdef1234567890ghijkl",
  • "lastModified": 1651578240,
  • "name": "NodeGoat",
  • "orgId": "example_org",
  • "projectId": "example_project",
  • "type": "repository",
}