Skip to Content
Services Variables

Create a new variable linked to a service

Deprecated

POST
/services/{service_id}/variables

Path Parameters

service_id*integer

The ID of the service.

Range1 <= value

Header Parameters

Accept*string

application/json

Authorization*string

Bearer {{access_token}}

Content-Type*string

application/json

Request Body

A JSON object containing the resource data

application/json
  1. body
key*string

The unique key used to identify the variable on the target. Must not be greater than 100 characters.

value*string

The 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?string

A text describing the variable, provided by the end user.

target*VariableTarget

The target defining how the variable key/value pair will be deployed

Value in"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*VariableType

The type of the key/value pair

Value in"file""symlink""variable"
hidden*boolean

Indicates if the variable value should be visible or not in the deployment logs.

Response Body

Created

application/json
  1. response
id*integer

The ID of the given variable

key*string

The unique key used to identify the variable on the target, or the filesystem path for configuration files and symlinks

type*VariableType

The type of the key/value pair

Value in"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*VariableTarget

The target defining how the variable key/value pair will be deployed

Value in"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*string

Human readable version of target

resource_id*|

The ID of the resource this variable is linked to

resource_type*string

The name of the resource this variable is linked to

hidden*boolean

Indicates if the variable value should be visible or not in the deployment logs

created_by_user?|null
created_at*string

The date and time when the record was created

updated_at*string

The date and time when the record was last updated

Example Request
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}'
Example Response
{  "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"}