Update an Environment Variable

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: Update an environment variable using Id.

Security: Requires a valid user

Usage: PUT api/v1/environmentVariables/:id

Consumes: application/json

URL Parameters:

Parameter

Type

Description

Required/Optional

Id

Integer

Environment variable id.

Required

Query String Parameters: Ignored

Request Parameters:

Parameter

Type

Description

Required/Optional

key

String

Environment variable key.

Required

value

String

Environment variable value.

Required

scope

String

Scope of the environment variable. It can be either 'global' or 'project'.

Default value is global.

Optional

projectId

Integer

Id of the Project.

Required if scope is set as 'project'.

isReadOnly

Boolean

Sets the precedence for the environment variable.

When set as true, this cannot be overridden by other environment variables. For example, if the scope is set asglobalandisReadOnlyis set astrue, other environment variables set at Project, pipeline, and step level cannot override the global environment variable.

Default value is false.

Optional

Produces: application/json

Sample Request:

curl -L -X POST 'https://icarus.jfrogdev.org/pipelines/api/v1/environmentVariables/4' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
        key: hello,
        value: world,
        scope: global,
        projectId: 2 
        isReadOnly: true
}'

Sample Response:

{
        Id: 4,
        key: hello,
        value: world,
        scope: global,
        projectId: 2 
        isReadOnly: true 
}

Response Codes:

200: Success