From d338087605791e408e696b11974995be9ebff80e Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 13 Jan 2016 18:51:06 +0100 Subject: Add 'Build' prefix to Variables entry name in API docs index --- doc/api/build_variables.md | 106 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 doc/api/build_variables.md (limited to 'doc/api/build_variables.md') diff --git a/doc/api/build_variables.md b/doc/api/build_variables.md new file mode 100644 index 00000000000..2b804fd9051 --- /dev/null +++ b/doc/api/build_variables.md @@ -0,0 +1,106 @@ +# Build Variables + +## Variables keys + +All variable keys must contains only letters, digits and '\_'. They must also be no longer than 255 characters. + +## List project variables + +Get list of variables of a project. + +``` +GET /projects/:id/variables +``` + +Parameters: + +- `id` (required) - The ID of a project + +```json +[ + { + "key": "TEST_VARIABLE_1", + "value": "TEST_1" + }, + { + "key": "TEST_VARIABLE_2", + "value": "TEST_2" + } +] +``` + +## Show variable details + +Get details of specifica variable of a project. + +``` +GET /projects/:id/variables/:key +``` + +Parameters: + +- `id` (required) - The ID of a project +- `key` (required) - The `key` of variable + +```json +{ + "key": "TEST_VARIABLE_1", + "value": "TEST_1" +} +``` + +## Create variable + +Create new variable in project. + +``` +POST /projects/:id/variables +``` + +Parameters: + +- `id` (required) - The ID of a project +- `key` (required) - The `key` for variable +- `value` (required) - The `value` for variable + +```json +{ + "key": "NEW_VARIABLE", + "value": "new value" +} +``` + +## Update variable + +Update variable. + +``` +PUT /projects/:id/variables/:key +``` + +Parameters: + +- `id` (required) - The ID of a project +- `key` (required) - The `key` for variable +- `value` (required) - The `value` for variable + +```json +{ + "key": "NEW_VARIABLE", + "value": "updated value" +} +``` + +## Remove variable + +Remove variable. + +``` +DELETE /projects/:id/variables/:key +``` + +Parameters: + +- `id` (required) - The ID of a project +- `key` (required) - The `key` for variable + -- cgit v1.2.1 From 2b81248ad5329a717d2f10f8c19453b989d202ac Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 13 Jan 2016 20:23:48 +0100 Subject: Modify builds API documentation style [ci skip] --- doc/api/build_variables.md | 84 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 20 deletions(-) (limited to 'doc/api/build_variables.md') diff --git a/doc/api/build_variables.md b/doc/api/build_variables.md index 2b804fd9051..5da5fb8f4a6 100644 --- a/doc/api/build_variables.md +++ b/doc/api/build_variables.md @@ -1,9 +1,5 @@ # Build Variables -## Variables keys - -All variable keys must contains only letters, digits and '\_'. They must also be no longer than 255 characters. - ## List project variables Get list of variables of a project. @@ -12,9 +8,19 @@ Get list of variables of a project. GET /projects/:id/variables ``` -Parameters: +### Parameters + +| Attribute | Type | required | Description | +|-----------|---------|----------|---------------------| +| id | integer | yes | The ID of a project | + +### Example of request + +``` +curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables" +``` -- `id` (required) - The ID of a project +### Example of response ```json [ @@ -37,10 +43,20 @@ Get details of specifica variable of a project. GET /projects/:id/variables/:key ``` -Parameters: +### Parameters -- `id` (required) - The ID of a project -- `key` (required) - The `key` of variable +| Attribute | Type | required | Description | +|-----------|---------|----------|-----------------------| +| id | integer | yes | The ID of a project | +| key | string | yes | The `key` of variable | + +### Example of request + +``` +curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/TEST_VARIABLE_1" +``` + +### Example of response ```json { @@ -57,11 +73,21 @@ Create new variable in project. POST /projects/:id/variables ``` -Parameters: +### Parameters + +| Attribute | Type | required | Description | +|-----------|---------|----------|-----------------------| +| id | integer | yes | The ID of a project | +| key | string | yes | The `key` of variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed | +| value | string | yes | The `value` of variable | -- `id` (required) - The ID of a project -- `key` (required) - The `key` for variable -- `value` (required) - The `value` for variable +### Example of request + +``` +curl -X POST -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables" -F "key=NEW_VARIABLE" -F "value=new value" +``` + +### Example of response ```json { @@ -78,11 +104,21 @@ Update variable. PUT /projects/:id/variables/:key ``` -Parameters: +### Parameters -- `id` (required) - The ID of a project -- `key` (required) - The `key` for variable -- `value` (required) - The `value` for variable +| Attribute | Type | required | Description | +|-----------|---------|----------|-------------------------| +| id | integer | yes | The ID of a project | +| key | string | yes | The `key` of variable | +| value | string | yes | The `value` of variable | + +### Example of request + +``` +curl -X PUT -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/NEW_VARIABLE" -F "value=updated value" +``` + +### Example of response ```json { @@ -99,8 +135,16 @@ Remove variable. DELETE /projects/:id/variables/:key ``` -Parameters: +### Parameters + +| Attribute | Type | required | Description | +|-----------|---------|----------|-------------------------| +| id | integer | yes | The ID of a project | +| key | string | yes | The `key` of variable | -- `id` (required) - The ID of a project -- `key` (required) - The `key` for variable +### Example of request + +``` +curl -X DELETE -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/VARIABLE_1" +``` -- cgit v1.2.1 From f11ba743a58ce769cdf6ea7427392836355c067d Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 13 Jan 2016 22:44:11 +0100 Subject: Add some cosmetic changes to variables API documentation [ci skip] --- doc/api/build_variables.md | 66 ++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 44 deletions(-) (limited to 'doc/api/build_variables.md') diff --git a/doc/api/build_variables.md b/doc/api/build_variables.md index 5da5fb8f4a6..b96f1bdac8a 100644 --- a/doc/api/build_variables.md +++ b/doc/api/build_variables.md @@ -2,26 +2,20 @@ ## List project variables -Get list of variables of a project. +Get list of a project's build variables. ``` GET /projects/:id/variables ``` -### Parameters - | Attribute | Type | required | Description | |-----------|---------|----------|---------------------| -| id | integer | yes | The ID of a project | - -### Example of request +| `id` | integer | yes | The ID of a project | ``` curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables" ``` -### Example of response - ```json [ { @@ -37,27 +31,21 @@ curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3 ## Show variable details -Get details of specifica variable of a project. +Get the details of a project's specific build variable. ``` GET /projects/:id/variables/:key ``` -### Parameters - | Attribute | Type | required | Description | |-----------|---------|----------|-----------------------| -| id | integer | yes | The ID of a project | -| key | string | yes | The `key` of variable | - -### Example of request +| `id` | integer | yes | The ID of a project | +| `key` | string | yes | The `key` of a variable | ``` curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/TEST_VARIABLE_1" ``` -### Example of response - ```json { "key": "TEST_VARIABLE_1", @@ -67,28 +55,22 @@ curl -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3 ## Create variable -Create new variable in project. +Create a new build variable. ``` POST /projects/:id/variables ``` -### Parameters - | Attribute | Type | required | Description | |-----------|---------|----------|-----------------------| -| id | integer | yes | The ID of a project | -| key | string | yes | The `key` of variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed | -| value | string | yes | The `value` of variable | - -### Example of request +| `id` | integer | yes | The ID of a project | +| `key` | string | yes | The `key` of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed | +| `value` | string | yes | The `value` of a variable | ``` curl -X POST -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables" -F "key=NEW_VARIABLE" -F "value=new value" ``` -### Example of response - ```json { "key": "NEW_VARIABLE", @@ -98,28 +80,22 @@ curl -X POST -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.co ## Update variable -Update variable. +Update a project's build variable. ``` PUT /projects/:id/variables/:key ``` -### Parameters - | Attribute | Type | required | Description | |-----------|---------|----------|-------------------------| -| id | integer | yes | The ID of a project | -| key | string | yes | The `key` of variable | -| value | string | yes | The `value` of variable | - -### Example of request +| `id` | integer | yes | The ID of a project | +| `key` | string | yes | The `key` of a variable | +| `value` | string | yes | The `value` of a variable | ``` curl -X PUT -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/NEW_VARIABLE" -F "value=updated value" ``` -### Example of response - ```json { "key": "NEW_VARIABLE", @@ -129,22 +105,24 @@ curl -X PUT -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com ## Remove variable -Remove variable. +Remove a project's build variable. ``` DELETE /projects/:id/variables/:key ``` -### Parameters - | Attribute | Type | required | Description | |-----------|---------|----------|-------------------------| -| id | integer | yes | The ID of a project | -| key | string | yes | The `key` of variable | - -### Example of request +| `id` | integer | yes | The ID of a project | +| `key` | string | yes | The `key` of a variable | ``` curl -X DELETE -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/VARIABLE_1" ``` +```json +{ + "key": "VARIABLE_1", + "value": "VALUE_1" +} +``` -- cgit v1.2.1