diff options
author | Luis Alonso Chavez Armendariz <lchavez@nearsoft.com> | 2016-11-24 20:28:52 +0300 |
---|---|---|
committer | Luis Alonso Chavez Armendariz <lchavez@nearsoft.com> | 2016-11-24 20:28:52 +0300 |
commit | ed61d44e1edfd41c36ec9085aa95f470bb5699fa (patch) | |
tree | fa1e469baab4423875bbe38b23d84517e25fd547 | |
parent | 843ae9b26e6d307c6b2e140e904b77565a649674 (diff) |
Remove unnecessary sentences for status codes in the API documentation
-rw-r--r-- | changelogs/unreleased/issue-24534.yml | 4 | ||||
-rw-r--r-- | doc/api/access_requests.md | 8 | ||||
-rw-r--r-- | doc/api/award_emoji.md | 4 | ||||
-rw-r--r-- | doc/api/boards.md | 10 | ||||
-rw-r--r-- | doc/api/branches.md | 7 | ||||
-rw-r--r-- | doc/api/broadcast_messages.md | 4 | ||||
-rw-r--r-- | doc/api/issues.md | 31 | ||||
-rw-r--r-- | doc/api/labels.md | 25 | ||||
-rw-r--r-- | doc/api/members.md | 10 | ||||
-rw-r--r-- | doc/api/merge_requests.md | 43 | ||||
-rw-r--r-- | doc/api/notes.md | 9 | ||||
-rw-r--r-- | doc/api/projects.md | 19 | ||||
-rw-r--r-- | doc/api/system_hooks.md | 3 | ||||
-rw-r--r-- | doc/api/tags.md | 21 | ||||
-rw-r--r-- | doc/api/users.md | 8 |
15 files changed, 48 insertions, 158 deletions
diff --git a/changelogs/unreleased/issue-24534.yml b/changelogs/unreleased/issue-24534.yml new file mode 100644 index 00000000000..14d6730d3f6 --- /dev/null +++ b/changelogs/unreleased/issue-24534.yml @@ -0,0 +1,4 @@ +--- +title: Remove unnecessary sentences for status codes in the API documentation +merge_request: +author: Luis Alonso Chavez Armendariz diff --git a/doc/api/access_requests.md b/doc/api/access_requests.md index ea308b54d62..dee3e384080 100644 --- a/doc/api/access_requests.md +++ b/doc/api/access_requests.md @@ -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 diff --git a/doc/api/award_emoji.md b/doc/api/award_emoji.md index 06111f4ab67..58092bdd400 100644 --- a/doc/api/award_emoji.md +++ b/doc/api/award_emoji.md @@ -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 diff --git a/doc/api/boards.md b/doc/api/boards.md index 28681719f43..c83db6df80c 100644 --- a/doc/api/boards.md +++ b/doc/api/boards.md @@ -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 diff --git a/doc/api/branches.md b/doc/api/branches.md index f68eeb9f86b..07dfa5d4d7f 100644 --- a/doc/api/branches.md +++ b/doc/api/branches.md @@ -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" diff --git a/doc/api/broadcast_messages.md b/doc/api/broadcast_messages.md index c3a9207a3ae..a3e9c01f335 100644 --- a/doc/api/broadcast_messages.md +++ b/doc/api/broadcast_messages.md @@ -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 ``` diff --git a/doc/api/issues.md b/doc/api/issues.md index 134263d27b4..16f8e32c82a 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -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. diff --git a/doc/api/labels.md b/doc/api/labels.md index 78686fdcad4..863b28c23b7 100644 --- a/doc/api/labels.md +++ b/doc/api/labels.md @@ -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 diff --git a/doc/api/members.md b/doc/api/members.md index 6535e9a7801..5dcb2a5f60a 100644 --- a/doc/api/members.md +++ b/doc/api/members.md @@ -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 diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index f4167403c2c..1df661369a4 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -337,9 +337,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. @@ -414,14 +411,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 @@ -440,15 +432,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 @@ -520,13 +511,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 ``` @@ -670,11 +659,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 @@ -747,10 +733,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 @@ -822,9 +806,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. ``` diff --git a/doc/api/notes.md b/doc/api/notes.md index 58d40eecf3e..ba20a885fc8 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -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 diff --git a/doc/api/projects.md b/doc/api/projects.md index 467a880ac13..4993448ff25 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -644,7 +644,7 @@ Parameters: ### Edit project -Updates an existing project +Updates an existing project. ``` PUT /projects/:id @@ -674,9 +674,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. @@ -694,8 +691,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 @@ -765,8 +761,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 @@ -837,10 +832,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 ``` @@ -926,10 +917,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 ``` diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index efd23d514bc..3fb8b73be6d 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -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. --- diff --git a/doc/api/tags.md b/doc/api/tags.md index 398b080e3f6..14573d48fe4 100644 --- a/doc/api/tags.md +++ b/doc/api/tags.md @@ -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 diff --git a/doc/api/users.md b/doc/api/users.md index b38c335490a..52a6b691610 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -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. |