Create a new variable linked to a service
Deprecated
service_id*integerThe ID of the service.
1 <= valueAccept*stringapplication/json
Content-Type*stringapplication/json
A JSON object containing the resource data
application/json- body
key*stringThe unique key used to identify the variable on the target. Must not be greater than 100 characters.
value*stringThe value to be assigned to this variable when deployed to its target.
When variable is of type file, this is the file content. Must not be greater than 21504 characters.
description?stringA text describing the variable, provided by the end user.
target*VariableTargetThe target defining how the variable key/value pair will be deployed
"my-cnf""newrelic-infra-yml""nginx-http-server""nginx-http""nginx-main""os-env-var""php-cli_php-ini""php-fpm_php-fpm-conf""php-fpm_php-ini""php-fpm_pool-d-www-conf""redis-conf""resource-config-file""resource-symlink""supervisord-conf""sysctl-conf"type*VariableTypeThe type of the key/value pair
"file""symlink""variable"hidden*booleanIndicates if the variable value should be visible or not in the deployment logs.
Created
application/json- response
id*integerThe ID of the given variable
key*stringThe unique key used to identify the variable on the target, or the filesystem path for configuration files and symlinks
type*VariableTypeThe type of the key/value pair
"file""symlink""variable"description*|A text describing the variable, provided by the end user
value*|The value to be assigned to this variable when deployed to its target. For configuration files this is the file content; for symlinks this is the symlink target path
target*VariableTargetThe target defining how the variable key/value pair will be deployed
"my-cnf""newrelic-infra-yml""nginx-http-server""nginx-http""nginx-main""os-env-var""php-cli_php-ini""php-fpm_php-fpm-conf""php-fpm_php-ini""php-fpm_pool-d-www-conf""redis-conf""resource-config-file""resource-symlink""supervisord-conf""sysctl-conf"target_human_readable*stringHuman readable version of target
resource_id*|The ID of the resource this variable is linked to
resource_type*stringThe name of the resource this variable is linked to
hidden*booleanIndicates if the variable value should be visible or not in the deployment logs
created_by_user?|nullcreated_at*stringThe date and time when the record was created
updated_at*stringThe date and time when the record was last updated
curl -X POST 'https://api.devopness.com/services/123/variables' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <your_api_token>' \ -H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \ -d '{ "key": "APP_URL", "value": "https://staging.devopness.com", "target": "resource-config-file", "type": "file", "hidden": false}'{ "id": 93023, "key": "APP_URL", "type": "file", "description": "Sample variable description", "value": "https://staging.devopness.com", "target": "resource-config-file", "target_human_readable": "Resource Configuration File", "resource_id": 3426, "resource_type": "application", "hidden": false, "created_by_user": { "id": 1, "name": "string", "email": "user@example.com", "url_slug": "someone", "language": "en", "active": true, "created_at": "2019-09-25T15:50:48.000000Z", "updated_at": "2019-09-25T13:52:04.000000Z" }, "created_at": "2022-09-26T15:30:31.000000Z", "updated_at": "2022-09-26T15:30:58.000000Z"}