Target Variants

Access and modify Scan Target Variants

Target Variants#ListTargetVariants

List a collection of Scan Target Variants

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

Associated Target ID

Example: abcdef1234567890ghijkl
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
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Aut incidunt.
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/{targetId}/variants
Request samples
Response samples
application/json
{
  • "pagination": {
    },
  • "results": [
    ]
}

Target Variants#CreateTargetVariant

Create a new Scan Target Variant

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

Associated Target ID

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

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Sapiente incidunt eaque explicabo.
Request Body schema: application/json
required
hash
string <= 64 characters

Git Commit or Container Image hash

required
object

Parameters for this Variant, as a JSON-encoded string

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/{targetId}/variants
Request samples
application/json
{
  • "hash": "d1998db4b4651a4b9be9ecf320a2dfb8b4710e35",
  • "parameters": {
    }
}
Response samples
application/json
{
  • "id": "abcdef1234567890ghijkl"
}

Target Variants#FindTargetVariantById

Find Scan Target Variant by ID

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

Associated Target ID

Examples:
abcdef1234567890ghijkl
id
required
string^[a-zA-Z0-9_-]{22}$

The ID of the Scan Target Variant to retrieve

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

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Quidem repellat nostrum molestiae sapiente ipsam.
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/{targetId}/variants/{id}
Request samples
Response samples
application/json
{
  • "created": 1651578240,
  • "hash": "d1998db4b4651a4b9be9ecf320a2dfb8b4710e35",
  • "id": "abcdef1234567890ghijkl",
  • "lastModified": 1651578240,
  • "parameters": {
    },
  • "targetId": "abcdef1234567890ghijkl"
}

Target Variants#UpdateTargetVariant

Update an existing Scan Target Variant

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

Associated Target ID

Examples:
abcdef1234567890ghijkl
id
required
string^[a-zA-Z0-9_-]{22}$

The ID of the Scan Target Variant to update

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

Harness Account ID

Example: accountId=abcdef1234567890ghijkl
header Parameters
X-Api-Key
string

Harness personal or service access token

Example: Occaecati odit et.
Request Body schema: application/json
required
hash
string <= 64 characters

Git Commit or Container Image hash

required
object

Parameters for this Variant, as a JSON-encoded string

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/{targetId}/variants/{id}
Request samples
application/json
{
  • "hash": "d1998db4b4651a4b9be9ecf320a2dfb8b4710e35",
  • "parameters": {
    }
}
Response samples
application/json
{
  • "created": 1651578240,
  • "hash": "d1998db4b4651a4b9be9ecf320a2dfb8b4710e35",
  • "id": "abcdef1234567890ghijkl",
  • "lastModified": 1651578240,
  • "parameters": {
    },
  • "targetId": "abcdef1234567890ghijkl"
}