Templates

This contains a list of APIs specific to the Templates Validations and Refresh

Get YAML with updated Template Inputs

Returns YAML with updated Template Inputs for a given YAML

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

getDefaultFromOtherRepo
boolean

if true, return all the default entities

header Parameters
Load-From-Cache
string
Default: false
Request Body schema:
required

YAML

yaml
required
string
Responses
400

Bad Request

500

Internal Server Error

default

Returns YAML with updated Template Inputs, when an underlying Template has been updated and a reconciliation is pending in a given YAML.

post/template/api/refresh-template/refreshed-yaml
Request samples
{
  • "yaml": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Validate Template Inputs in a YAML

Validates the Template Inputs in a pipeline's YAML specification. If the Template Inputs are invalid, the operation returns an error summary.

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

templateIdentifier
required
string

Template Identifier for the entity

versionLabel
required
string

Template version

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

getDefaultFromOtherRepo
boolean

if true, return all the default entities

header Parameters
Load-From-Cache
string
Default: false
Responses
400

Bad Request

500

Internal Server Error

default

Returns a validation result for Template Inputs present in a YAML specification.

get/template/api/refresh-template/validate-template-inputs
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Create a Template

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

rootFolder
string

Path to the root folder of the Entity. [Applicable for Old Git Sync only]

filePath
string

File Path of the Entity.

commitMsg
string

File Path of the Entity.

isNewBranch
boolean
Default: false

Checks the new branch

baseBranch
string

Name of the default branch.

connectorRef
string

Identifier of Connector needed for CRUD operations on the respective Entity

storeType
string

Tells whether the Entity is to be saved on Git or not

Enum: "INLINE" "REMOTE"
repoName
string

Name of the repository.

isHarnessCodeRepo
boolean

Is Harness code repo enabled

setDefaultTemplate
boolean
Default: false

Specify true if Default Template is to be set

comments
string

Comments

isNewTemplate
boolean
Default: false

When isNewTemplate flag is set user will not be able to create a new version for an existing template

Request Body schema:
required

Template YAML

string
Responses
400

Bad Request

500

Internal Server Error

default

Returns the created Template

post/template/api/templates
Request samples

Sample Template YAML

"template:\n name: pipelineTemplate\n identifier: pipelineTemplate\n versionLabel: v1\n type: Pipeline\n projectIdentifier: TemplateDemo\n orgIdentifier: default\n tags: {}\n spec:\n stages:\n - stage:\n name: stage1\n identifier: stage1\n description: \"\"\n type: Deployment\n spec:\n deploymentType: Kubernetes\n service:\n serviceRef: <+input>\n serviceInputs: <+input>\n environment:\n environmentRef: <+input>\n deployToAll: false\n environmentInputs: <+input>\n infrastructureDefinitions: <+input>\n execution:\n steps:\n - step:\n type: ShellScript\n name: Shell Script_1\n identifier: ShellScript_1\n spec:\n shell: Bash\n onDelegate: true\n source:\n type: Inline\n spec:\n script: <+input>\n environmentVariables: []\n outputVariables: []\n timeout: 10m\n rollbackSteps: []\n tags: {}\n failureStrategies:\n - onFailure:\n errors:\n - AllErrors\n action:\n type: StageRollback\n"
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Delete Template Version

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

versionLabel
required
string

Version Label

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

rootFolder
string

Path to the root folder of the Entity. [Applicable for Old Git Sync only]

filePath
string

File Path of the Entity.

commitMsg
string

Commit Message to use for the merge commit.

lastObjectId
string

Last Object Id

comments
string
forceDelete
boolean
Default: false

If true, the Entity will be forced delete, without checking any references/usages

header Parameters
If-Match
string
Responses
400

Bad Request

500

Internal Server Error

default

Returns true if the Template is deleted

delete/template/api/templates/{templateIdentifier}/{versionLabel}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Get Template

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

versionLabel
string

Version Label

deleted
boolean
Default: false

Specifies whether Template is deleted or not

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

getDefaultFromOtherRepo
boolean

if true, return all the default entities

loadFromFallbackBranch
boolean
Default: false
header Parameters
Load-From-Cache
string
Default: false
Responses
400

Bad Request

500

Internal Server Error

default

Returns the saved Template

get/template/api/templates/{templateIdentifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Gets Template Input Set YAML

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

versionLabel
required
string

Template Label

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

getDefaultFromOtherRepo
boolean

if true, return all the default entities

header Parameters
Load-From-Cache
string
Default: false
Responses
400

Bad Request

500

Internal Server Error

default

Returns the Template Input Set YAML

get/template/api/templates/templateInputs/{templateIdentifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Gets all metadata of template list

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

page
integer <int32>
Default: 0

Page Index of the results to fetch.Default Value: 0

size
integer <int32>
Default: 25

Results per page

sort
Array of strings

Specifies sorting criteria of the list. Like sorting based on the last updated entity, alphabetical sorting in an ascending or descending order

searchTerm
string

The word to be searched and included in the list response

filterIdentifier
string

Filter Identifier

templateListType
required
string

Template List Type

Enum: "Stable" "LastUpdated" "All"
includeAllTemplatesAvailableAtScope
boolean

Specify true if all accessible Templates are to be included

getDistinctFromBranches
boolean
Request Body schema:

This contains details of Template filters based on Template Types and Template Names

object

Filter tags as a key-value pair.

filterType
required
string

This specifies the corresponding Entity of the filter.

Enum: "Connector" "Secret" "DelegateProfile" "Delegate" "PipelineSetup" "PipelineExecution" "Deployment" "Audit" "Template" "Trigger" "EnvironmentGroup" "FileStore" "CCMRecommendation" "Anomaly" "Environment" "RuleExecution" "Override" "InputSet" "Webhook"
templateNames
Array of strings
templateIdentifiers
Array of strings
description
string
templateEntityTypes
Array of strings
Items Enum: "Step" "Stage" "Pipeline" "CustomDeployment" "MonitoredService" "SecretManager" "ArtifactSource" "StepGroup" "Workspace"
childTypes
Array of strings
object (TemplateScope)

This contains scope of template being created

repoName
string
Responses
400

Bad Request

500

Internal Server Error

default

Returns a list of all the metadata of all Templates

post/template/api/templates/list-metadata
Request samples
{
  • "tags": {
    },
  • "filterType": "Connector",
  • "templateNames": [
    ],
  • "templateIdentifiers": [
    ],
  • "description": "string",
  • "templateEntityTypes": [
    ],
  • "childTypes": [
    ],
  • "listingScope": {
    },
  • "repoName": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Move Template YAML from inline to remote

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

connectorRef
string

Identifier of Connector needed for CRUD operations on the respective Entity

repoName
string

Name of the repository.

branch
string

Name of the branch.

filePath
string

File Path of the Entity.

commitMsg
string

Commit Message to use for the merge commit.

isNewBranch
boolean
Default: false

Checks the new branch

baseBranch
string

Name of the default branch.

moveConfigType
string

Tells weather the entity has to be moved from inline to remote or remote to inline

Value: "INLINE_TO_REMOTE"
versionLabel
required
string

Version Label

Responses
400

Bad Request

500

Internal Server Error

default

Fetches Template YAML from Harness DB and creates a remote entity

post/template/api/templates/move-config/{templateIdentifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Update Template Version

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

versionLabel
required
string

Version Label

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

rootFolder
string

Path to the root folder of the Entity. [Applicable for Old Git Sync only]

filePath
string

File Path of the Entity.

commitMsg
string

Commit Message to use for the merge commit.

lastObjectId
string

Its required field during update call request. It can be fetched from the response of GET API call for the entity

resolvedConflictCommitId
string

If the entity is git-synced, this parameter represents the commit id against which file conflicts are resolved

baseBranch
string

Name of the default branch.

connectorRef
string

Identifier of Connector needed for CRUD operations on the respective Entity

lastCommitId
string

last commit id of the file

isNewBranch
boolean
Default: false

Checks the new branch

isHarnessCodeRepo
boolean

Is Harness code repo enabled

setDefaultTemplate
boolean
Default: false

Specify true if Default Template is to be set

comments
string

Comments

header Parameters
If-Match
string
Request Body schema:
required

Template YAML

string
Responses
400

Bad Request

500

Internal Server Error

default

Returns the updated Template Version

put/template/api/templates/update/{templateIdentifier}/{versionLabel}
Request samples

Sample Template YAML

"template:\n name: pipelineTemplate\n identifier: pipelineTemplate\n versionLabel: v1\n type: Pipeline\n projectIdentifier: TemplateDemo\n orgIdentifier: default\n tags: {}\n spec:\n stages:\n - stage:\n name: stage1\n identifier: stage1\n description: \"\"\n type: Deployment\n spec:\n deploymentType: Kubernetes\n service:\n serviceRef: <+input>\n serviceInputs: <+input>\n environment:\n environmentRef: <+input>\n deployToAll: false\n environmentInputs: <+input>\n infrastructureDefinitions: <+input>\n execution:\n steps:\n - step:\n type: ShellScript\n name: Shell Script_1\n identifier: ShellScript_1\n spec:\n shell: Bash\n onDelegate: true\n source:\n type: Inline\n spec:\n script: <+input>\n environmentVariables: []\n outputVariables: []\n timeout: 10m\n rollbackSteps: []\n tags: {}\n failureStrategies:\n - onFailure:\n errors:\n - AllErrors\n action:\n type: StageRollback\n"
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Update git metadata details for a remote template

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

versionLabel
required
string

Version Label

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

Request Body schema:

This contains details of Git Entity like Git Branch info to be updated

filePath
string

filepath to be updated

repoName
string

repo name to be updated

connectorRef
string

connector ref to be updated

Responses
400

Bad Request

500

Internal Server Error

default

Update git metadata details for a remote template

post/template/api/templates/update/git-metadata/{templateIdentifier}/{versionLabel}
Request samples
{
  • "filePath": "string",
  • "repoName": "string",
  • "connectorRef": "string"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Update Stable Template Version

Securityx-api-key
Request
path Parameters
templateIdentifier
required
string

Template Identifier for the entity

versionLabel
required
string

Version Label

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

branch
string

Name of the branch.

repoIdentifier
string

Git Sync Config Id. [Applicable for Old Git Sync only]

getDefaultFromOtherRepo
boolean

if true, return all the default entities

comments
string

Comments

Responses
400

Bad Request

500

Internal Server Error

default

Returns the updated Template Version

put/template/api/templates/updateStableTemplate/{templateIdentifier}/{versionLabel}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}