リファレンスHTTP APIVariables

Create or replace a workspace variable

PUT
/v1/workspace/variables/{name}

Owners and admins, signed in as a person; never an API key. If-None-Match: * creates, If-Match: <version> replaces the value. A new variable reaches no agent until it is granted. Only kind: plain is accepted for now: a secret answers 400 SECRET_ENV_UNSUPPORTED. The value is text of at most 48 KB without NUL bytes. Writes a set_env_variable receipt that names the variable and its version, never the value.

Auth: cookie session only; no scope. Idempotency-Key: ignored.

Authorization

cookieSession
cookie__Host-werft_session<token>

For the web console: the browser session cookie set by POST /v1/auth/login. It holds the scopes of the user's workspace role (owner: all; admin and member: all but sessions:recover). Requests other than GET must also send X-Requested-With: werft-web.

Path Parameters

name*string

The variable's name.

Length1 <= length

Header Parameters

If-Match?string

The version last read, as a number (an entity tag's quotes are allowed). A different one answers 412 VERSION_MISMATCH; none answers 428 PRECONDITION_REQUIRED. Send it to change a variable that exists, If-None-Match: * to create one; never both.

Length1 <= length
If-None-Match?"*"

The literal *, to create a variable that must not exist yet. One that exists answers 412 VERSION_MISMATCH.

Value in"*"
X-Requested-With?"werft-web"

Required with a cookie session: the literal werft-web.

Value in"werft-web"

Request Body

application/json
  1. body
kind*string
Value in"plain""secret"
value*string
engine_delivery?boolean
acknowledge_engine_exposure?boolean
allow_automation?boolean

Response Body

The variable's new version and its grant_version.

application/json
  1. response
name*string
Match^[A-Z][A-Z0-9_]{0,63}$
version*integer
Range0 < value <= 9007199254740991
grant_version*integer
Range0 < value <= 9007199254740991
Example Request
curl -X PUT 'https://example.com/v1/workspace/variables/string' \  -H 'Content-Type: application/json' \  -d '{  "kind": "plain",  "value": "ap-northeast-1"}'
Example Response
{  "name": "REGION",  "version": 44,  "grant_version": 42}