Commit 76044593 authored by Nick Gaskill's avatar Nick Gaskill

Merge branch 'update-protected-environment-api-docs' into 'master'

Update protected environment API docs

See merge request gitlab-org/gitlab!46234
parents 79e4e2ee 332cb84e
...@@ -96,7 +96,7 @@ POST /projects/:id/protected_environments ...@@ -96,7 +96,7 @@ POST /projects/:id/protected_environments
``` ```
```shell ```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/protected_environments?name=staging&deploy_access_levels%5B%5D%5Buser_id%5D=1" curl --header 'Content-Type: application/json' --request POST --data '{"name": "production", "deploy_access_levels": [{"group_id": 9899826}]}' --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/22034114/protected_environments"
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
...@@ -105,21 +105,22 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitla ...@@ -105,21 +105,22 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitla
| `name` | string | yes | The name of the environment. | | `name` | string | yes | The name of the environment. |
| `deploy_access_levels` | array | yes | Array of access levels allowed to deploy, with each described by a hash. | | `deploy_access_levels` | array | yes | Array of access levels allowed to deploy, with each described by a hash. |
Elements in the `deploy_access_levels` array should take the Elements in the `deploy_access_levels` array should be one of `user_id`, `group_id` or
form `{user_id: integer}`, `{group_id: integer}` or `{access_level: integer}`. `access_level`, and take the form `{user_id: integer}`, `{group_id: integer}` or
`{access_level: integer}`.
Each user must have access to the project and each group must [have this project shared](../user/project/members/share_project_with_groups.md). Each user must have access to the project and each group must [have this project shared](../user/project/members/share_project_with_groups.md).
Example response: Example response:
```json ```json
{ {
"name":"staging", "name":"production",
"deploy_access_levels":[ "deploy_access_levels":[
{ {
"access_level":null, "access_level":40,
"access_level_description":"Administrator", "access_level_description":"protected-access-group",
"user_id":1, "user_id":null,
"group_id":null "group_id":9899826
} }
] ]
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment