リファレンスHTTP APIVariables

Replace the agents that may receive a workspace variable

PUT
/v1/workspace/variables/{name}/grants

Owners and admins; never an API key. The whole set is replaced. grant_all: true takes no agents. If-Match: <grant_version> is required, so two edits of the same grants cannot overwrite each other: the later one answers 412. Writes a set_env_variable_grants receipt with the set before and after.

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

Length1 <= length
X-Requested-With?"werft-web"

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

Value in"werft-web"

Request Body

application/json
  1. body
grant_all*boolean
agents*array<>

Response Body

The grants now held, and their new grant_version.

application/json
  1. response
name*string
Match^[A-Z][A-Z0-9_]{0,63}$
grant_version*integer
Range0 < value <= 9007199254740991
Example Request
curl -X PUT 'https://example.com/v1/workspace/variables/string/grants' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "grant_all": false,  "agents": [    {      "id": "8d2c4f1a-6b3e-4a9d-b7c5-2e1f0a9b8c7d"    }  ]}'
Example Response
{  "name": "REGION",  "grant_version": 43}