Edit Environment Variable

Updates an environment variable. Restricted to admins only.

Required scopes: WORKSPACE, VARIABLE_MANAGE

Resource URL

PATCH /workspaces/:domain/variables/:variable_id

URL Parameters

NameTypeDescription
domain
Required
StringThe workspace domain.
variable_id
Required
IntegerThe numerical ID of the desired variable.

POST Parameters

NameTypeDescription
key
StringThe name of the variable.
value
StringThe value of the variable.
typeStringThe type of the added variable. Can be one of VAR, SSH_KEY.
descriptionStringThe optional description of the variable.
ssh_keyBooleanIf set to true the variable will be treated as an SSH key.
settableBooleanIf set to true the variable value can be set by Buddy actions.
encryptedBooleanIf set to true the variable value will be encrypted and hidden.
file_placeStringAvailable values: CONTAINER, NONE. Set if type is SSH_KEY. If it's NONE, the variable can be used as a parameter in an action. For CONTAINER, the given key is additionally copied to an action container on each run.
file_nameStringThe name of the file. Set if type is SSH_KEY or FILE.
file_pathStringSpecifies where to copy the file on each run. Set if type is SSH_KEY or FILE.
file_chmodStringFile permission set on copy to a container on each run. Set if type is SSH_KEY or FILE.

Example

Request

PATCH https://api.buddy.works/workspaces/buddy/variables/1

JSON

{
    "value": "-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz/qH9/t6jCVuGPHcDDvnyqtasOlsjZOgF9dtRioNG93GrLPzDoi+SgUBzesoKXb1CGOW1wKAzLSADzuFMKwSydxCBVwziGZ33F+XsnHGKX3mpx8rRZV2UWNHRtJK3wmJHfEsIDHznPcbJT2I++cK36yGGpiNtzItfdvhExeFeXJVjp/BrZS2D4ixBu5VjqFe5XskIN6N//QCgfwxTwmnhoGBnB8xiWnDCHHUP/rf6Tr6FPneWt2zE5H53kqApT1boDN/VgaltptjW5zh6DnN6S9zhMBY4OkQoQQ1pCWrH56uryYaqTdslkoP4F1Hos9DkkCwCce8J/uFLE6PVY7Xk6JiQIDAQABAoIBAEOd5TTXetkzlh7gCzWjCFIY7d0SAaXdNCg9Fq/IYRzXT6sEwKYyt3g0WqbY1FkpaeojzXIH7tNDE/nabcWuNsC77oYgy3m8J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QASD+p6+goJLgpKuKQJQ2LQJZgi1gvw+jBeTJPILXQgt1Q==-----END RSA PRIVATE KEY-----",
    "type": "SSH_KEY",
    "encrypted": true,
    "description": "My Server Key",
    "file_name": "id_my_key",
    "file_path": "~/.ssh/id_my_key",
    "file_chmod": "600",
    "file_place": "CONTAINER"
}

Example response

HTTP

Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
    "url": "https://api.buddy.works/workspaces/buddytest/variables/1",
    "id": 1,
    "key": "id_my_key",
    "value": "secure!wrhFNb0bE+u7EBP9//Uyi4grDjGq3QswCJdWnF5CXW2YhbCWLC2jvT0VgnmWohdUlrhTlS7gmuMpXBaPTdywhZ1q90HtFTaAhlUe+dgc7eTYHp5wmeFUYfgzI6bsXu/+0IDInlWJS7tGqsokcdacAcrlOhLcUimVLjR3uhm2K+KqwtX0rNhf14NxWtI6F8VdyIIzQs4XH6Ol0pRPEXdEB57ThBDEMeEXxYeeO4oueQ0aGM+bVK64fEmFar5X8IQrasmkFfbNW1XId2WxwX23NZma5Mce6NQ7R0yjrLACtYawtuhLEn0C2E1iE/VZviYegMxf+wf4NPpdtMW5lv7BjrXNM8FNpMXRaombF4BfnqQkARDIaPxt3UeCP9ZX+HLXxQvSMgSl55UZkFBKUXn9bHyil9TDAJysVIwn5Dhy1j8XzXT+8jrnA5jS0Ch+axyVydUAxek8e7am0rkpfRCVFKonyBExP+GhLfThoBJUtxetDMY9SNvq19/W9smnDewanupkuwMji7MLPYlVOvkhyeh978xJPeQX/UvWOn6Xb/rSQU3FrOOOZAMW1jJTfJXrudIBGakbl8w8rCOp4do5IjZmti7BeSVkKNpE1YYLpyit+4atzCUX8FlHSoafcE4QozQvFLM2iNXE5LgEvMcBE1F7/YQvseN5IiQnCnpB8MVw2wdpwk+eaP64ztN3ueGo/JkBppgtDLJxIWnL4/udsLpaBEO9nksNMkUa1gnOYK150YPxe8/rBIEIi2gC9TYmXgd1jzNdMgK2Djc1UXtdeSwG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H67aCZWth75qswrK5T3lym2uthJrbdE1F7UYkqEgpJyBD0IXmyMC2ey/oKCs3UXriEy/NFe5QFZ5mZ/8gKa7E2I6JeV1WfiinDRtZDTcpDykTZ138mWhKcK2IiWue+ZTA7XTp1xllo+/WIBo+vRMv8yI3ecHeqmuGaXzwutXfFreticwvglsXV9DxGYUlaHdOq30PKiqRclhFW2JZYD0i2NCAzbdvxDx2azVSBkpq7OH9ogvmOP7w8OdI52XZ2bY9cSXPAPw=.IOCC4LynFRFWrd6O+Sp6Rg==",
    "type": "SSH_KEY",
    "encrypted": true,
    "description": "My Server Key",
    "file_name": "id_my_key",
    "file_path": "~/.ssh/id_my_key",
    "file_chmod": "600",
    "file_place": "CONTAINER",
    "public_value": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAs9yoz6vqv/mh7md3ApyB6EEz5DKR2uLcOFmDxFfolnRB8YxFZoxK7Ac+BV2/PNWUK/sm/n/RWc6a6JWdNwbQ9nm4A9mAMJQgRyls/PW0AIHkflO1Dzon4C7j4RJt7ijf1kFxosmVz6MaBEvMV82IpagtTGUsm4jXXclYj04QsMkUiG5JBwrl5qB6kemqUoUCptqcXlDZXtVDZBbS1HtuMXbFC8ANscbhT9+L5JX6PDwc1tozcjKDLpDpar7G8YJ5zFFBTjw/adcE2JkCB3cG9LLBbWbGFAIGsyiNBRa4wHJQP9rAKebpt4vFAof8Yg0IAvtvmoBRa5L8yousThjvQvMmWYR0QToeUx6GZzrWMZ9Z5Wa6dVqbQBRS1p4m/Xv+VaH5hI00hc3zEmow58NoKSPhipvmS5Xk74aLrj7/Wj7lHSzu54apFnhN1+1+QhC+8ITNa6lHNUY0t9xiJ5auRGDmUFsBICdPr+Npt7sOsZbdUHk/Ka0Y7hIFIElTDbWdo7sxwKenWnwrB0Y2qDprVYKgZFGbuQd57FqOYP5TF6S6raMSo03dZjj5WJpYDXJXP1RMFkFwzZUZxdqKmty+yBvf0/kd6zlr+WPTlf+CMb4l9FjwIYsYfQuBnVzwwjHVCFkbYHa1KTMBVxSAMHi4/JWgU4fDJtMMB/yvxXvG7n0=",
    "key_fingerprint": "d3:5a:ef:be:46:dc:ea:c9:95:51:78:54:36:da:7c:9d",
    "checksum": "b7827991973f4c275a70d51e96bd3e09474ac9beba74ea17d24081e83c8c13ad"
}