For the complete documentation index, see llms.txt. This page is also available as Markdown.

Target Variants

Access and modify Scan Target Variants

get
/api/v2/targets/{targetId}/variants

List a collection of Scan Target Variants

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
pageinteger · int64Optional

Page number to fetch (starting from 0)

Default: 0Example: 4
pageSizeinteger · int64 · min: 1 · max: 100Optional

Number of results per page

Default: 30Example: 50
namestringOptional

Resource name

Example: NodeGoat
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Laboriosam magnam.
Responses
200

OK response.

application/json
get/api/v2/targets/{targetId}/variants
GET /gateway/sto/api/v2/targets/{targetId}/variants?accountId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "pagination": {
    "link": "",
    "page": 4,
    "pageSize": 20,
    "totalItems": 230,
    "totalPages": 12
  },
  "results": [
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    }
  ]
}
post
/api/v2/targets/{targetId}/variants

Create a new Scan Target Variant

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Labore nesciunt necessitatibus magnam fugit et debitis.
Body
hashstring · max: 64Optional

Git Commit or Container Image hash

Example: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
Responses
200

OK response.

application/json
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
post/api/v2/targets/{targetId}/variants
POST /gateway/sto/api/v2/targets/{targetId}/variants?accountId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 82

{
  "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
  "parameters": {
    "branch": "main"
  }
}
{
  "id": "abcdef1234567890ghijkl"
}
get
/api/v2/targets/{targetId}/variants/{id}

Find Scan Target Variant by ID

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
idstringRequired

The ID of the Scan Target Variant to retrieve

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Deleniti maxime ut labore.
Responses
200

OK response.

application/json

Information about a Scan Target Variant

createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
hashstring · max: 64Optional

Git Commit or Container Image hash

Example: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
lastModifiedinteger · int64Required

Unix timestamp at which the resource was most recently modified

Example: 1651578240
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
get/api/v2/targets/{targetId}/variants/{id}
GET /gateway/sto/api/v2/targets/{targetId}/variants/{id}?accountId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "created": 1651578240,
  "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "parameters": {
    "branch": "main"
  },
  "targetId": "abcdef1234567890ghijkl"
}
put
/api/v2/targets/{targetId}/variants/{id}

Update an existing Scan Target Variant

Required scopes
This endpoint requires the following scopes:
Authorizations
X-Api-KeystringRequired
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
idstringRequired

The ID of the Scan Target Variant to update

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Header parameters
X-Api-KeystringOptional

Harness personal or service access token

Example: Veniam consequatur cum nihil dolor deserunt possimus.
Body
hashstring · max: 64Optional

Git Commit or Container Image hash

Example: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
Responses
200

OK response.

application/json

Information about a Scan Target Variant

createdinteger · int64Required

Unix timestamp at which the resource was created

Example: 1651578240
hashstring · max: 64Optional

Git Commit or Container Image hash

Example: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
idstringRequired

Resource identifier

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
lastModifiedinteger · int64Required

Unix timestamp at which the resource was most recently modified

Example: 1651578240
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
put/api/v2/targets/{targetId}/variants/{id}
PUT /gateway/sto/api/v2/targets/{targetId}/variants/{id}?accountId=abcdef1234567890ghijkl HTTP/1.1
Host: app.harness.io
X-Api-Key: YOUR_API_KEY
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 82

{
  "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
  "parameters": {
    "branch": "main"
  }
}
{
  "created": 1651578240,
  "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
  "id": "abcdef1234567890ghijkl",
  "lastModified": 1651578240,
  "parameters": {
    "branch": "main"
  },
  "targetId": "abcdef1234567890ghijkl"
}

Last updated

Was this helpful?