diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-06-13 20:04:36 -0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-06-26 10:10:11 +0800 |
commit | 550ac52b143b7d4b77203b81c1b92997c4c63e34 (patch) | |
tree | 799d859632a2ff74fa93f4a3e0760cadc2113b2b /doc/api | |
parent | 13ab6a3842407b481ab536576f8d8517a23baa49 (diff) | |
download | gitlab-ce-550ac52b143b7d4b77203b81c1b92997c4c63e34.tar.gz |
Add documentation for feature and API
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/project_aliases.md | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/doc/api/project_aliases.md b/doc/api/project_aliases.md new file mode 100644 index 00000000000..4456388c74f --- /dev/null +++ b/doc/api/project_aliases.md @@ -0,0 +1,101 @@ +# Project Aliases API + +All methods require administrator authorization. + +## List all project aliases + +Get a list of all project aliases + +``` +GET /project_aliases +``` + +``` +curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases" +``` + +Example response: + +```json +[ + { + "id": 1, + "project_id": 1, + "name": "gitlab-ce" + }, + { + "id": 2, + "project_id": 2, + "name": "gitlab-ee" + } +] +``` + +## Get project alias' details + +Get details of a project alias + +``` +GET /project_aliases/:name +``` + +| Attribute | Type | Required | Description | +|-----------|--------|----------|-----------------------| +| `name` | string | yes | The name of the alias | + +``` +curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases/gitlab-ee" +``` + +Example response: + +```json +{ + "id": 1, + "project_id": 1, + "name": "gitlab-ee" +} +``` + +## Create an alias for a project + +Add a new alias for a project. Reponds with a 201 when successful, 400 when there are validation errors (e.g. alias already exists). + +``` +POST /project_aliases +``` + +| Attribute | Type | Required | Description | +|--------------|--------|----------|-----------------------------------------------| +| `project_id` | string | yes | The The ID or URL-encoded path of the project | +| `name` | string | yes | The name of the alias. Must be unique. | + +``` +curl --request POST "https://gitlab.example.com/api/v4/project_aliases" --form "project_id=gitlab-org%2Fgitlab-ee" --form "name=gitlab-ee" +``` + +Example response: + +```json +{ + "id": 1, + "project_id": 1, + "name": "gitlab-ee" +} +``` + +## Delete a project aliase + +Removes a project aliases. Respond with a 204 when project alias exists, 404 when it doesn't. + +``` +DELETE /project_aliases/:name +``` + +| Attribute | Type | Required | Description | +|-----------|--------|----------|-----------------------| +| `name` | string | yes | The name of the alias | + +``` +curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases/gitlab-ee" +``` |