Skip to main content

Create/Update Environment Variable

Endpoint: PUT /api/environment/{key}

Creates or updates an environment variable. The requesting user must have either an Admin or Metadata role.

Path parameters

ParameterDescriptionTypeRequired/ Optional
keyA unique identifier for the variable. This name will be used to reference the variable in workflow definitionsstringRequired.

Request body

Format the request body as plain text or a JSON string. The request body must contain the raw value of the environment variable.

Example (Plain text):

keyValue

Example (JSON string):

{"endpoint": "https://api.example.com", "timeout": 60}

Response

Returns 200, indicating that the environment variable has been created or updated successfully.

Examples

Create a plain-text environment variable

Request

curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/environment/keyName' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: text/plain' \
-d 'keyValue'

Response

Returns 200, indicating that the environment variable has been created successfully.

Create a JSON-based environment variable

Request

curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/environment/url' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: text/plain' \
-d '{ "baseUrl": "https://orkes-api-tester.orkesconductor.com/api", "timeout": 5000 }'

Response

Returns 200, indicating that the environment variable has been created successfully.

Update an existing environment variable

Request

curl -X 'PUT' \
'https://<YOUR-SERVER-URL>/api/environment/keyName' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: text/plain' \
-d 'updatedKeyValue'

Response

Returns 200, indicating that the environment variable has been updated successfully.