Commit d03ca3d0 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'issue-24534' into 'master'

Remove unnecessary sentences for return codes in the API documentation

Closes #24534

See merge request !7511
parents fc035011 ed61d44e
---
title: Remove unnecessary sentences for status codes in the API documentation
merge_request:
author: Luis Alonso Chavez Armendariz
......@@ -18,8 +18,6 @@
Gets a list of access requests viewable by the authenticated user.
Returns `200` if the request succeeds.
```
GET /groups/:id/access_requests
GET /projects/:id/access_requests
......@@ -61,8 +59,6 @@ Example response:
Requests access for the authenticated user to a group or project.
Returns `201` if the request succeeds.
```
POST /groups/:id/access_requests
POST /projects/:id/access_requests
......@@ -94,8 +90,6 @@ Example response:
Approves an access request for the given user.
Returns `201` if the request succeeds.
```
PUT /groups/:id/access_requests/:user_id/approve
PUT /projects/:id/access_requests/:user_id/approve
......@@ -129,8 +123,6 @@ Example response:
Denies an access request for the given user.
Returns `200` if the request succeeds.
```
DELETE /groups/:id/access_requests/:user_id
DELETE /projects/:id/access_requests/:user_id
......
......@@ -158,7 +158,7 @@ Example Response:
### Delete an award emoji
Sometimes its just not meant to be, and you'll have to remove your award. Only available to
admins or the author of the award. Status code 200 on success, 401 if unauthorized.
admins or the author of the award.
```
DELETE /projects/:id/issues/:issue_id/award_emoji/:award_id
......@@ -331,7 +331,7 @@ Example Response:
### Delete an award emoji
Sometimes its just not meant to be, and you'll have to remove your award. Only available to
admins or the author of the award. Status code 200 on success, 401 if unauthorized.
admins or the author of the award.
```
DELETE /projects/:id/issues/:issue_id/notes/:note_id/award_emoji/:award_id
......
......@@ -148,10 +148,6 @@ Example response:
Creates a new Issue Board list.
If the operation is successful, a status code of `200` and the newly-created
list is returned. If an error occurs, an error number and a message explaining
the reason is returned.
```
POST /projects/:id/boards/:board_id/lists
```
......@@ -184,10 +180,6 @@ Example response:
Updates an existing Issue Board list. This call is used to change list position.
If the operation is successful, a code of `200` and the updated board list is
returned. If an error occurs, an error number and a message explaining the
reason is returned.
```
PUT /projects/:id/boards/:board_id/lists/:list_id
```
......@@ -220,8 +212,6 @@ Example response:
## Delete a board list
Only for admins and project owners. Soft deletes the board list in question.
If the operation is successful, a status code `200` is returned. In case you cannot
destroy this board list, or it is not present, code `404` is given.
```
DELETE /projects/:id/boards/:board_id/lists/:list_id
......
......@@ -212,9 +212,6 @@ Example response:
}
```
It returns `200` if it succeeds or `400` if failed with an error message
explaining the reason.
## Delete repository branch
```
......@@ -226,8 +223,7 @@ DELETE /projects/:id/repository/branches/:branch
| `id` | integer | yes | The ID of a project |
| `branch` | string | yes | The name of the branch |
It returns `200` if it succeeds, `404` if the branch to be deleted does not exist
or `400` for other reasons. In case of an error, an explaining message is provided.
In case of an error, an explaining message is provided.
```bash
curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/5/repository/branches/newbranch"
......@@ -253,7 +249,6 @@ DELETE /projects/:id/repository/merged_branches
| --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of a project |
It returns `200` to indicate deletion of all merged branches was started.
```bash
curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/5/repository/merged_branches"
......
......@@ -62,10 +62,6 @@ Example response:
## Create a broadcast message
Responds with `400 Bad request` when the `message` parameter is missing or the
`color` or `font` values are invalid, and `201 Created` when the broadcast
message was successfully created.
```
POST /broadcast_messages
```
......
......@@ -315,10 +315,6 @@ Example response:
Creates a new project issue.
If the operation is successful, a status code of `200` and the newly-created
issue is returned. If an error occurs, an error number and a message explaining
the reason is returned.
```
POST /projects/:id/issues
```
......@@ -377,10 +373,6 @@ Example response:
Updates an existing project issue. This call is also used to mark an issue as
closed.
If the operation is successful, a code of `200` and the updated issue is
returned. If an error occurs, an error number and a message explaining the
reason is returned.
```
PUT /projects/:id/issues/:issue_id
```
......@@ -439,8 +431,6 @@ Example response:
## Delete an issue
Only for admins and project owners. Soft deletes the issue in question.
If the operation is successful, a status code `200` is returned. In case you cannot
destroy this issue, or it is not present, code `404` is given.
```
DELETE /projects/:id/issues/:issue_id
......@@ -457,9 +447,7 @@ curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://git
## Move an issue
Moves an issue to a different project. If the operation is successful, a status
code `201` together with moved issue is returned. If the project, issue, or
target project is not found, error `404` is returned. If the target project
Moves an issue to a different project. If the target project
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
......@@ -518,11 +506,9 @@ Example response:
## Subscribe to an issue
Subscribes the authenticated user to an issue to receive notifications. If the
operation is successful, status code `201` together with the updated issue is
returned. If the user is already subscribed to the issue, the status code `304`
is returned. If the project or issue is not found, status code `404` is
returned.
Subscribes the authenticated user to an issue to receive notifications.
If the user is already subscribed to the issue, the status code `304`
is returned.
```
POST /projects/:id/issues/:issue_id/subscription
......@@ -576,10 +562,8 @@ Example response:
## Unsubscribe from an issue
Unsubscribes the authenticated user from the issue to not receive notifications
from it. If the operation is successful, status code `200` together with the
updated issue is returned. If the user is not subscribed to the issue, the
status code `304` is returned. If the project or issue is not found, status code
`404` is returned.
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
```
DELETE /projects/:id/issues/:issue_id/subscription
......@@ -633,8 +617,7 @@ Example response:
## Create a todo
Manually creates a todo for the current user on an issue. If the request is
successful, status code `200` together with the created todo is returned. If
Manually creates a todo for the current user on an issue. If
there already exists a todo for the user on that issue, status code `304` is
returned.
......
......@@ -82,9 +82,6 @@ Example response:
Creates a new label for the given repository with the given name and color.
It returns 200 if the label was successfully created, 400 for wrong parameters
and 409 if the label already exists.
```
POST /projects/:id/labels
```
......@@ -121,10 +118,6 @@ Example response:
Deletes a label with a given name.
It returns 200 if the label was successfully deleted, 400 for wrong parameters
and 404 if the label does not exist.
In case of an error, an additional error message is returned.
```
DELETE /projects/:id/labels
```
......@@ -159,10 +152,6 @@ Example response:
Updates an existing label with new name or new color. At least one parameter
is required, to update the label.
It returns 200 if the label was successfully deleted, 400 for wrong parameters
and 404 if the label does not exist.
In case of an error, an additional error message is returned.
```
PUT /projects/:id/labels
```
......@@ -199,11 +188,9 @@ Example response:
## Subscribe to a label
Subscribes the authenticated user to a label to receive notifications. If the
operation is successful, status code `201` together with the updated label is
returned. If the user is already subscribed to the label, the status code `304`
is returned. If the project or label is not found, status code `404` is
returned.
Subscribes the authenticated user to a label to receive notifications.
If the user is already subscribed to the label, the status code `304`
is returned.
```
POST /projects/:id/labels/:label_id/subscription
......@@ -237,10 +224,8 @@ Example response:
## Unsubscribe from a label
Unsubscribes the authenticated user from a label to not receive notifications
from it. If the operation is successful, status code `200` together with the
updated label is returned. If the user is not subscribed to the label, the
status code `304` is returned. If the project or label is not found, status code
`404` is returned.
from it. If the user is not subscribed to the label, the
status code `304` is returned.
```
DELETE /projects/:id/labels/:label_id/subscription
......
......@@ -16,8 +16,6 @@ The access levels are defined in the `Gitlab::Access` module. Currently, these l
Gets a list of group or project members viewable by the authenticated user.
Returns `200` if the request succeeds.
```
GET /groups/:id/members
GET /projects/:id/members
......@@ -60,8 +58,6 @@ Example response:
Gets a member of a group or project.
Returns `200` if the request succeeds.
```
GET /groups/:id/members/:user_id
GET /projects/:id/members/:user_id
......@@ -95,8 +91,6 @@ Example response:
Adds a member to a group or project.
Returns `201` if the request succeeds.
```
POST /groups/:id/members
POST /projects/:id/members
......@@ -131,8 +125,6 @@ Example response:
Updates a member of a group or project.
Returns `200` if the request succeeds.
```
PUT /groups/:id/members/:user_id
PUT /projects/:id/members/:user_id
......@@ -167,8 +159,6 @@ Example response:
Removes a user from a group or project.
Returns `200` if the request succeeds.
```
DELETE /groups/:id/members/:user_id
DELETE /projects/:id/members/:user_id
......
......@@ -338,9 +338,6 @@ Parameters:
}
```
If the operation is successful, 200 and the newly created merge request is returned.
If an error occurs, an error number and a message explaining the reason is returned.
## Update MR
Updates an existing merge request. You can change the target branch, title, or even close the MR.
......@@ -415,14 +412,9 @@ Parameters:
}
```
If the operation is successful, 200 and the updated merge request is returned.
If an error occurs, an error number and a message explaining the reason is returned.
## Delete a merge request
Only for admins and project owners. Soft deletes the merge request in question.
If the operation is successful, a status code `200` is returned. In case you cannot
destroy this merge request, or it is not present, code `404` is given.
```
DELETE /projects/:id/merge_requests/:merge_request_id
......@@ -441,15 +433,14 @@ curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://git
Merge changes submitted with MR using this API.
If the merge succeeds you'll get a `200 OK`.
If it has some conflicts and can not be merged - you'll get a 405 and the error message 'Branch cannot be merged'
If it has some conflicts and can not be merged - you'll get a `405` and the error message 'Branch cannot be merged'
If merge request is already merged or closed - you'll get a 406 and the error message 'Method Not Allowed'
If merge request is already merged or closed - you'll get a `406` and the error message 'Method Not Allowed'
If the `sha` parameter is passed and does not match the HEAD of the source - you'll get a 409 and the error message 'SHA does not match HEAD of source branch'
If the `sha` parameter is passed and does not match the HEAD of the source - you'll get a `409` and the error message 'SHA does not match HEAD of source branch'
If you don't have permissions to accept this merge request - you'll get a 401
If you don't have permissions to accept this merge request - you'll get a `401`
```
PUT /projects/:id/merge_requests/:merge_request_id/merge
......@@ -521,13 +512,11 @@ Parameters:
## Cancel Merge When Build Succeeds
If successful you'll get `200 OK`.
If you don't have permissions to accept this merge request - you'll get a `401`
If you don't have permissions to accept this merge request - you'll get a 401
If the merge request is already merged or closed - you get `405` and error message 'Method Not Allowed'
If the merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
In case the merge request is not set to be merged when the build succeeds, you'll also get a 406 error.
In case the merge request is not set to be merged when the build succeeds, you'll also get a `406` error.
```
PUT /projects/:id/merge_requests/:merge_request_id/cancel_merge_when_build_succeeds
```
......@@ -671,11 +660,8 @@ Example response when an external issue tracker (e.g. JIRA) is used:
## Subscribe to a merge request
Subscribes the authenticated user to a merge request to receive notification. If
the operation is successful, status code `201` together with the updated merge
request is returned. If the user is already subscribed to the merge request, the
status code `304` is returned. If the project or merge request is not found,
status code `404` is returned.
Subscribes the authenticated user to a merge request to receive notification. If the user is already subscribed to the merge request, the
status code `304` is returned.
```
POST /projects/:id/merge_requests/:merge_request_id/subscription
......@@ -748,10 +734,8 @@ Example response:
## Unsubscribe from a merge request
Unsubscribes the authenticated user from a merge request to not receive
notifications from that merge request. If the operation is successful, status
code `200` together with the updated merge request is returned. If the user is
not subscribed to the merge request, the status code `304` is returned. If the
project or merge request is not found, status code `404` is returned.
notifications from that merge request. If the user is
not subscribed to the merge request, the status code `304` is returned.
```
DELETE /projects/:id/merge_requests/:merge_request_id/subscription
......@@ -823,9 +807,8 @@ Example response:
## Create a todo
Manually creates a todo for the current user on a merge request. If the
request is successful, status code `200` together with the created todo is
returned. If there already exists a todo for the user on that merge request,
Manually creates a todo for the current user on a merge request.
If there already exists a todo for the user on that merge request,
status code `304` is returned.
```
......
......@@ -109,8 +109,7 @@ Parameters:
### Delete an issue note
Deletes an existing note of an issue. On success, this API method returns 200
and the deleted note. If the note does not exist, the API returns 404.
Deletes an existing note of an issue.
```
DELETE /projects/:id/issues/:issue_id/notes/:note_id
......@@ -234,8 +233,7 @@ Parameters:
### Delete a snippet note
Deletes an existing note of a snippet. On success, this API method returns 200
and the deleted note. If the note does not exist, the API returns 404.
Deletes an existing note of a snippet.
```
DELETE /projects/:id/snippets/:snippet_id/notes/:note_id
......@@ -364,8 +362,7 @@ Parameters:
### Delete a merge request note
Deletes an existing note of a merge request. On success, this API method returns
200 and the deleted note. If the note does not exist, the API returns 404.
Deletes an existing note of a merge request.
```
DELETE /projects/:id/merge_requests/:merge_request_id/notes/:note_id
......
......@@ -645,7 +645,7 @@ Parameters:
### Edit project
Updates an existing project
Updates an existing project.
```
PUT /projects/:id
......@@ -676,9 +676,6 @@ Parameters:
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
On success, method returns 200 with the updated project. If parameters are
invalid, 400 is returned.
### Fork project
Forks a project into the user namespace of the authenticated user or the one provided.
......@@ -696,8 +693,7 @@ Parameters:
### Star a project
Stars a given project. Returns status code `201` and the project on success and
`304` if the project is already starred.
Stars a given project. Returns status code `304` if the project is already starred.
```
POST /projects/:id/star
......@@ -767,8 +763,7 @@ Example response:
### Unstar a project
Unstars a given project. Returns status code `200` and the project on success
and `304` if the project is not starred.
Unstars a given project. Returns status code `304` if the project is not starred.
```
DELETE /projects/:id/star
......@@ -839,10 +834,6 @@ Example response:
Archives the project if the user is either admin or the project owner of this project. This action is
idempotent, thus archiving an already archived project will not change the project.
Status code 201 with the project as body is given when successful, in case the user doesn't
have the proper access rights, code 403 is returned. Status 404 is returned if the project
doesn't exist, or is hidden to the user.
```
POST /projects/:id/archive
```
......@@ -928,10 +919,6 @@ Example response:
Unarchives the project if the user is either admin or the project owner of this project. This action is
idempotent, thus unarchiving an non-archived project will not change the project.
Status code 201 with the project as body is given when successful, in case the user doesn't
have the proper access rights, code 403 is returned. Status 404 is returned if the project
doesn't exist, or is hidden to the user.
```
POST /projects/:id/unarchive
```
......
......@@ -108,8 +108,7 @@ Example response:
## Delete system hook
Deletes a system hook. It returns `200 OK` if the hooks is deleted and
`404 Not Found` if the hook is not found.
Deletes a system hook.
---
......
......@@ -40,9 +40,7 @@ Parameters:
## Get a single repository tag
Get a specific repository tag determined by its name. It returns `200` together
with the tag information if the tag exists. It returns `404` if the tag does not
exist.
Get a specific repository tag determined by its name.
```
GET /projects/:id/repository/tags/:tag_name
......@@ -124,14 +122,12 @@ Parameters:
The message will be `nil` when creating a lightweight tag otherwise
it will contain the annotation.
It returns 201 if the operation succeed. In case of an error,
405 with an explaining error message is returned.
In case of an error,
status code `405` with an explaining error message is returned.
## Delete a tag
Deletes a tag of a repository with given name. On success, this API method
returns 200 with the name of the deleted tag. If the tag does not exist, the
API returns 404.
Deletes a tag of a repository with given name.
```
DELETE /projects/:id/repository/tags/:tag_name
......@@ -150,9 +146,8 @@ Parameters:
## Create a new release
Add release notes to the existing git tag. It returns 201 if the release is
created successfully. If the tag does not exist, 404 is returned. If there
already exists a release for the given tag, 409 is returned.
Add release notes to the existing git tag. If there
already exists a release for the given tag, status code `409` is returned.
```
POST /projects/:id/repository/tags/:tag_name/release
......@@ -173,9 +168,7 @@ Parameters:
## Update a release
Updates the release notes of a given release. It returns 200 if the release is
successfully updated. If the tag or the release does not exist, it returns 404
with a proper error message.
Updates the release notes of a given release.
```
PUT /projects/:id/repository/tags/:tag_name/release
......
......@@ -271,8 +271,8 @@ Parameters:
- `can_create_group` (optional) - User can create groups - true or false
- `external` (optional) - Flags the user as external - true or false(default)
Note, at the moment this method does only return a 404 error,
even in cases where a 409 (Conflict) would be more appropriate,
Note, at the moment this method does only return a `404` error,
even in cases where a `409` (Conflict) would be more appropriate,
e.g. when renaming the email address to some existing one.
## User deletion
......@@ -449,8 +449,6 @@ Parameters:
- `title` (required) - new SSH Key's title
- `key` (required) - new SSH key
Will return created key with status `201 Created` on success, or `404 Not found` on fail.
## Delete SSH key for current user
Deletes key owned by currently authenticated user.
......@@ -581,8 +579,6 @@ Parameters:
- `id` (required) - id of specified user
- `email` (required) - email address
Will return created email with status `201 Created` on success, or `404 Not found` on fail.
## Delete email for current user
Deletes email owned by currently authenticated user.
......
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