Variables

This contains APIs related to Variables as defined in Harness.

Creates a Variable.

SecurityApiKey
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema: application/json

Details of the Variable to create.

object (VariableDTO)
Responses
400

Bad Request

500

Internal server error

default

Returns the created Variable.

post/ng/api/variables
Request samples
application/json
{
  • "variable": {
    }
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Deletes Variable by ID.

SecurityApiKey
Request
path Parameters
identifier
required
string

Variable ID

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

Responses
400

Bad Request

500

Internal server error

default

It returns true if the Variable is deleted successfully and false if the Variable is not deleted.

delete/ng/api/variables/{identifier}
Request samples
curl -i -X DELETE \
  'https://app.harness.io/gateway/ng/api/variables/{identifier}?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Fetches the list of Variables.

SecurityApiKey
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.

pageIndex
integer <int32>
Default: 0

Page number of navigation. The default value is 0.

pageSize
integer <int32>
Default: 100

Number of entries per page. The default value is 100.

searchTerm
string

This would be used to filter Variables. Any Variable having the specified string in its Name or ID would be filtered.

includeVariablesFromEverySubScope
boolean
Default: false

Specify whether or not to include all the Variables accessible at the scope. For eg if set as true, at the Project scope we will get org and account Variable also in the response.

Responses
400

Bad Request

500

Internal server error

default

Returns the list of Variable.

get/ng/api/variables
Request samples
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/variables?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&pageIndex=0&pageSize=100&searchTerm=string&includeVariablesFromEverySubScope=false' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Get the Variable by scope identifiers and variable identifier.

SecurityApiKey
Request
path Parameters
identifier
required
string

Variable ID

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

Responses
400

Bad Request

500

Internal server error

default

Returns the variable with the requested scope identifiers and variable identifier.

get/ng/api/variables/{identifier}
Request samples
curl -i -X GET \
  'https://app.harness.io/gateway/ng/api/variables/{identifier}?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string' \
  -H 'x-api-key: YOUR_API_KEY_HERE'
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Updates the Variable.

SecurityApiKey
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema: application/json

Details of the variable to update.

object (VariableDTO)
Responses
400

Bad Request

500

Internal server error

default

Returns the updated Variable.

put/ng/api/variables
Request samples
application/json
{
  • "variable": {
    }
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}