Commit 39114d25 authored by Sebastian Ziebell's avatar Sebastian Ziebell

API: documentation contains infos to status codes in README file.

All the info to return codes from the API functions are available in the `README.md` file as suggested.
parent b5ef6d22
...@@ -27,6 +27,42 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/p ...@@ -27,6 +27,42 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/p
The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL. The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL.
## Status codes
API requests return different status codes according to
The API is designed to provide status codes according to the context and how the request
is handled. For example if a `GET` request is successful a status code `200 Ok`
is returned. The API is designed to be RESTful.
The following list gives an overview of how the API functions are designed.
API request types:
* `GET` requests access one or more resources and return the result as JSON
* `POST` requests return `201 Created` if the resource is successfully created and return the newly created resource as JSON
* `GET`, `PUT` and `DELETE` return `200 Ok` if the resource is accessed, modified or deleted successfully, the (modified) result is returned as JSON
* `DELETE` requests are designed to be idempotent, meaning a request a resource still returns `200 Ok` even it was deleted before or is not available. The reasoning behind it is the user is not really interested if the resource existed before or not.
The following list shows the possible return codes for API requests.
Return values:
* `200 Ok` - The `GET`, `PUT` or `DELETE` request was successful, the resource(s) itself is returned as JSON
* `201 Created` - The `POST` request was successful and the resource is returned as JSON
* `400 Bad Request` - A required attribute of the API request is missing, e.g. the title of an issue is not given
* `401 Unauthorized` - The user is not authenticated, a valid user token is necessary, see above
* `403 Forbidden` - The request is not allowed, e.g. the user is not allowed to delete a project
* `404 Not Found` - A resource could not be accessed, e.g. an ID for a resource could not be found
* `405 Method Not Allowed` - The request is not supported
* `409 Conflict` - A conflicting resource already exists, a project with same name already exists
* `500 Server Error` - While handling the request something went wrong on the server side
#### Pagination #### Pagination
When listing resources you can pass the following parameters: When listing resources you can pass the following parameters:
......
...@@ -17,12 +17,6 @@ GET /groups ...@@ -17,12 +17,6 @@ GET /groups
] ]
``` ```
Return values:
+ `200 Ok` on success and list of groups
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if something fails
## Details of a group ## Details of a group
...@@ -36,12 +30,6 @@ Parameters: ...@@ -36,12 +30,6 @@ Parameters:
+ `id` (required) - The ID of a group + `id` (required) - The ID of a group
Return values:
+ `200 Ok` on success and the details of a group
+ `401 Unauthorized` if user not authenticated
+ `404 Not Found` if group ID not found
## New group ## New group
...@@ -56,10 +44,3 @@ Parameters: ...@@ -56,10 +44,3 @@ Parameters:
+ `name` (required) - The name of the group + `name` (required) - The name of the group
+ `path` (required) - The path of the group + `path` (required) - The path of the group
Return valueS:
+ `201 Created` on success and the newly created group
+ `400 Bad Request` if one of the required attributes not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if something fails
...@@ -69,13 +69,6 @@ GET /issues ...@@ -69,13 +69,6 @@ GET /issues
] ]
``` ```
Return values:
+ `200 Ok` on success and the list of issues
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if something fails
## List project issues ## List project issues
...@@ -90,12 +83,6 @@ Parameters: ...@@ -90,12 +83,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
Return values:
+ `200 Ok` on success and the list of project issues
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Single issue ## Single issue
...@@ -150,12 +137,6 @@ Parameters: ...@@ -150,12 +137,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the list of project issues
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or issue ID not found
## New issue ## New issue
...@@ -174,13 +155,6 @@ Parameters: ...@@ -174,13 +155,6 @@ Parameters:
+ `milestone_id` (optional) - The ID of a milestone to assign issue + `milestone_id` (optional) - The ID of a milestone to assign issue
+ `labels` (optional) - Comma-separated label names for an issue + `labels` (optional) - Comma-separated label names for an issue
Return values:
+ `201 Created` on success and the newly created project issue
+ `400 Bad Request` if the required attribute title is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Edit issue ## Edit issue
...@@ -201,12 +175,6 @@ Parameters: ...@@ -201,12 +175,6 @@ Parameters:
+ `labels` (optional) - Comma-separated label names for an issue + `labels` (optional) - Comma-separated label names for an issue
+ `closed` (optional) - The state of an issue (0 = false, 1 = true) + `closed` (optional) - The state of an issue (0 = false, 1 = true)
Return values:
+ `200 Ok` on success and the update project issue
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or issue ID not found
## Delete existing issue (**Deprecated**) ## Delete existing issue (**Deprecated**)
...@@ -223,6 +191,3 @@ Parameters: ...@@ -223,6 +191,3 @@ Parameters:
+ `id` (required) - The project ID + `id` (required) - The project ID
+ `issue_id` (required) - The ID of the issue + `issue_id` (required) - The ID of the issue
Return values:
+ `405 Method Not Allowed` is always returned, because the function is deprecated
...@@ -41,12 +41,6 @@ Parameters: ...@@ -41,12 +41,6 @@ Parameters:
] ]
``` ```
Return values:
+ `200 Ok` on success and the list of merge requests
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Get single MR ## Get single MR
...@@ -89,12 +83,6 @@ Parameters: ...@@ -89,12 +83,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the single merge request
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or merge request ID not found
## Create MR ## Create MR
...@@ -140,14 +128,6 @@ Parameters: ...@@ -140,14 +128,6 @@ Parameters:
} }
``` ```
Return values:
+ `201 Created` on success and the created merge request
+ `400 Bad Request` if one of the required attributes is missing
+ `401 Unauthorize` if user is not authenticated or not allowed
+ `403 Forbidden` if user is not allowed to create a merge request
+ `404 Not Found` if project ID not found or something else fails
## Update MR ## Update MR
...@@ -196,13 +176,6 @@ Parameters: ...@@ -196,13 +176,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the updated merge request
+ `401 Unauthorize` if user is not authenticated or not allowed
+ `403 Forbidden` if user is not allowed to update the merge request
+ `404 Not Found` if project ID or merge request ID not found
## Post comment to MR ## Post comment to MR
...@@ -232,10 +205,3 @@ Parameters: ...@@ -232,10 +205,3 @@ Parameters:
"note":"text1" "note":"text1"
} }
``` ```
Return values:
+ `201 Created` on success and the new comment
+ `400 Bad Request` if the required attribute note is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or merge request ID not found
...@@ -10,12 +10,6 @@ Parameters: ...@@ -10,12 +10,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
Return values:
+ `200 Ok` on success and the list of project milestones
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Get single milestone ## Get single milestone
...@@ -30,12 +24,6 @@ Parameters: ...@@ -30,12 +24,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `milestone_id` (required) - The ID of a project milestone + `milestone_id` (required) - The ID of a project milestone
Return values:
+ `200 Ok` on success and the single milestone
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Create new milestone ## Create new milestone
...@@ -52,13 +40,6 @@ Parameters: ...@@ -52,13 +40,6 @@ Parameters:
+ `description` (optional) - The description of the milestone + `description` (optional) - The description of the milestone
+ `due_date` (optional) - The due date of the milestone + `due_date` (optional) - The due date of the milestone
Return values:
+ `201 Created` on success and the new milestone
+ `400 Bad Request` if the required attribute title is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Edit milestone ## Edit milestone
...@@ -77,8 +58,3 @@ Parameters: ...@@ -77,8 +58,3 @@ Parameters:
+ `due_date` (optional) - The due date of the milestone + `due_date` (optional) - The due date of the milestone
+ `closed` (optional) - The status of the milestone + `closed` (optional) - The status of the milestone
Return values:
+ `200 Ok` on success and the updated milestone
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or milestone ID not found
...@@ -30,11 +30,6 @@ Parameters: ...@@ -30,11 +30,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
Return values:
+ `200 Ok` on success and a list of notes
+ `401 Unauthorized` if user is not authorized to access this page
### Get single wall note ### Get single wall note
...@@ -49,12 +44,6 @@ Parameters: ...@@ -49,12 +44,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `note_id` (required) - The ID of a wall note + `note_id` (required) - The ID of a wall note
Return values:
+ `200 Ok` on success and the wall note (see example at `GET /projects/:id/notes`)
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if note ID not found
### Create new wall note ### Create new wall note
...@@ -69,14 +58,6 @@ Parameters: ...@@ -69,14 +58,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `body` (required) - The content of a note + `body` (required) - The content of a note
Return values:
+ `201 Created` on success and the new wall note
+ `400 Bad Request` if attribute body is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if something else fails
## Issues ## Issues
...@@ -93,12 +74,6 @@ Parameters: ...@@ -93,12 +74,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `issue_id` (required) - The ID of an issue + `issue_id` (required) - The ID of an issue
Return values:
+ `200 Ok` on success and a list of notes for a single issue
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or issue ID not found
### Get single issue note ### Get single issue note
...@@ -114,12 +89,6 @@ Parameters: ...@@ -114,12 +89,6 @@ Parameters:
+ `issue_id` (required) - The ID of a project issue + `issue_id` (required) - The ID of a project issue
+ `note_id` (required) - The ID of an issue note + `note_id` (required) - The ID of an issue note
Return values:
+ `200 Ok` on success and the single issue note
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID, issue ID or note ID is not found
### Create new issue note ### Create new issue note
...@@ -135,14 +104,6 @@ Parameters: ...@@ -135,14 +104,6 @@ Parameters:
+ `issue_id` (required) - The ID of an issue + `issue_id` (required) - The ID of an issue
+ `body` (required) - The content of a note + `body` (required) - The content of a note
Return values:
+ `201 Created` on succes and the created note
+ `400 Bad Request` if the required attribute body is not given
+ `401 Unauthorized` if the user is not authenticated
+ `404 Not Found` if the project ID or the issue ID not found
## Snippets ## Snippets
...@@ -159,12 +120,6 @@ Parameters: ...@@ -159,12 +120,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `snippet_id` (required) - The ID of a project snippet + `snippet_id` (required) - The ID of a project snippet
Return values:
+ `200 Ok` on success and a list of notes for a single snippet
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or issue ID not found
### Get single snippet note ### Get single snippet note
...@@ -180,12 +135,6 @@ Parameters: ...@@ -180,12 +135,6 @@ Parameters:
+ `snippet_id` (required) - The ID of a project snippet + `snippet_id` (required) - The ID of a project snippet
+ `note_id` (required) - The ID of an snippet note + `note_id` (required) - The ID of an snippet note
Return values:
+ `200 Ok` on success and the single snippet note
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID, snippet ID or note ID is not found
### Create new snippet note ### Create new snippet note
...@@ -201,14 +150,6 @@ Parameters: ...@@ -201,14 +150,6 @@ Parameters:
+ `snippet_id` (required) - The ID of an snippet + `snippet_id` (required) - The ID of an snippet
+ `body` (required) - The content of a note + `body` (required) - The content of a note
Return values:
+ `201 Created` on success and the new snippet note
+ `400 Bad Request` if the required attribute body not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or snippet ID not found
## Merge Requests ## Merge Requests
...@@ -225,12 +166,6 @@ Parameters: ...@@ -225,12 +166,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `merge_request_id` (required) - The ID of a project merge request + `merge_request_id` (required) - The ID of a project merge request
Return values:
+ `200 Ok` on success and a list of notes for a single merge request
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or merge request ID not found
### Get single merge request note ### Get single merge request note
...@@ -246,12 +181,6 @@ Parameters: ...@@ -246,12 +181,6 @@ Parameters:
+ `merge_request_id` (required) - The ID of a project merge request + `merge_request_id` (required) - The ID of a project merge request
+ `note_id` (required) - The ID of a merge request note + `note_id` (required) - The ID of a merge request note
Return values:
+ `200 Ok` on success and the single merge request note
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID, merge request ID or note ID is not found
### Create new merge request note ### Create new merge request note
...@@ -267,10 +196,3 @@ Parameters: ...@@ -267,10 +196,3 @@ Parameters:
+ `merge_request_id` (required) - The ID of a merge request + `merge_request_id` (required) - The ID of a merge request
+ `body` (required) - The content of a note + `body` (required) - The content of a note
Return values:
+ `201 Created` on success and the new merge request note
+ `400 Bad Request` if the required attribute body not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or merge request ID not found
...@@ -57,11 +57,6 @@ GET /projects ...@@ -57,11 +57,6 @@ GET /projects
] ]
``` ```
Return values:
+ `200 Ok` on success and a list of projects
+ `401 Unauthorized` if the user is not allowed to access projects
### Get single project ### Get single project
...@@ -101,11 +96,6 @@ Parameters: ...@@ -101,11 +96,6 @@ Parameters:
} }
``` ```
Return Values:
+ `200 Ok` if the project with given ID is found and the JSON response
+ `404 Not Found` if no project with ID found
### Create project ### Create project
...@@ -125,13 +115,6 @@ Parameters: ...@@ -125,13 +115,6 @@ Parameters:
+ `merge_requests_enabled` (optional) - enabled by default + `merge_requests_enabled` (optional) - enabled by default
+ `wiki_enabled` (optional) - enabled by default + `wiki_enabled` (optional) - enabled by default
Return values:
+ `201 Created` on success with the project data (see example at `GET /projects/:id`)
+ `400 Bad Request` if the required attribute name is not given
+ `403 Forbidden` if the user is not allowed to create a project, e.g. reached the project limit already
+ `404 Not Found` if something else fails
## Project access levels ## Project access levels
...@@ -159,11 +142,6 @@ Parameters: ...@@ -159,11 +142,6 @@ Parameters:
+ `id` (required) - The ID or NAME of a project + `id` (required) - The ID or NAME of a project
+ `query` - Query string + `query` - Query string
Return Values:
+ `200 Ok` on success and a list of found team members
+ `404 Not Found` if project with ID not found
## Team members ## Team members
...@@ -192,11 +170,6 @@ Parameters: ...@@ -192,11 +170,6 @@ Parameters:
} }
``` ```
Return Values:
+ `200 Ok` on success and the team member, see example
+ `404 Not Found` if either the project or the team member could not be found
### Add project team member ### Add project team member
...@@ -214,14 +187,6 @@ Parameters: ...@@ -214,14 +187,6 @@ Parameters:
+ `user_id` (required) - The ID of a user to add + `user_id` (required) - The ID of a user to add
+ `access_level` (required) - Project access level + `access_level` (required) - Project access level
Return Values:
+ `201 Created` on success and the added user is returned, even if the user is already team member
+ `400 Bad Request` if the required attribute access_level is not given
+ `401 Unauthorized` if the user is not allowed to add a new team member
+ `404 Not Found` if a resource can not be found, e.g. project with ID not available
+ `422 Unprocessable Entity` if an unknown access_level is given
### Edit project team member ### Edit project team member
...@@ -237,14 +202,6 @@ Parameters: ...@@ -237,14 +202,6 @@ Parameters:
+ `user_id` (required) - The ID of a team member + `user_id` (required) - The ID of a team member
+ `access_level` (required) - Project access level + `access_level` (required) - Project access level
Return Values:
+ `200 Ok` on succes and the modified team member
+ `400 Bad Request` if the required attribute access_level is not given
+ `401 Unauthorized` if the user is not allowed to modify a team member
+ `404 Not Found` if a resource can not be found, e.g. project with ID not available
+ `422 Unprocessable Entity` if an unknown access_level is given
### Remove project team member ### Remove project team member
...@@ -259,12 +216,6 @@ Parameters: ...@@ -259,12 +216,6 @@ Parameters:
+ `id` (required) - The ID or NAME of a project + `id` (required) - The ID or NAME of a project
+ `user_id` (required) - The ID of a team member + `user_id` (required) - The ID of a team member
Return Values:
+ `200 Ok` on success
+ `401 Unauthorized` if user is not allowed to remove a team member
+ `404 Not Found` if either project or user can not be found
This method is idempotent and can be called multiple times with the same parameters. This method is idempotent and can be called multiple times with the same parameters.
Revoking team membership for a user who is not currently a team member is considered success. Revoking team membership for a user who is not currently a team member is considered success.
Please note that the returned JSON currently differs slightly. Thus you should not Please note that the returned JSON currently differs slightly. Thus you should not
...@@ -285,12 +236,6 @@ Parameters: ...@@ -285,12 +236,6 @@ Parameters:
+ `id` (required) - The ID or NAME of a project + `id` (required) - The ID or NAME of a project
Return values:
+ `200 Ok` on success with a list of hooks
+ `401 Unauthorized` if user is not allowed to get list of hooks
+ `404 Not Found` if project can not be found
### Get project hook ### Get project hook
...@@ -313,11 +258,6 @@ Parameters: ...@@ -313,11 +258,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on sucess and the hook with the given ID
+ `404 Not Found` if the hook can not be found
### Add project hook ### Add project hook
...@@ -332,13 +272,6 @@ Parameters: ...@@ -332,13 +272,6 @@ Parameters:
+ `id` (required) - The ID or NAME of a project + `id` (required) - The ID or NAME of a project
+ `url` (required) - The hook URL + `url` (required) - The hook URL
Return values:
+ `201 Created` on success and the newly created hook
+ `400 Bad Request` if url is not given
+ `404 Not Found` if project with ID not found
+ `422 Unprocessable Entity` if the url is invalid (must begin with `http` or `https`)
### Edit project hook ### Edit project hook
...@@ -354,13 +287,6 @@ Parameters: ...@@ -354,13 +287,6 @@ Parameters:
+ `hook_id` (required) - The ID of a project hook + `hook_id` (required) - The ID of a project hook
+ `url` (required) - The hook URL + `url` (required) - The hook URL
Return values:
+ `200 Ok` on success and the modified hook (see JSON response above)
+ `400 Bad Request` if the url attribute is not given
+ `404 Not Found` if project or hook can not be found
+ `422 Unprocessable Entity` if the url is invalid (must begin with `http` or `https`)
### Delete project hook ### Delete project hook
...@@ -376,12 +302,6 @@ Parameters: ...@@ -376,12 +302,6 @@ Parameters:
+ `id` (required) - The ID or NAME of a project + `id` (required) - The ID or NAME of a project
+ `hook_id` (required) - The ID of hook to delete + `hook_id` (required) - The ID of hook to delete
Return values:
+ `200 Ok` on succes
+ `403 Forbidden` if user is not allowed to delete a hook
+ `404 Not Found` if the project can not be found
Note the JSON response differs if the hook is available or not. If the project hook Note the JSON response differs if the hook is available or not. If the project hook
is available before it is returned in the JSON response or an empty response is returned. is available before it is returned in the JSON response or an empty response is returned.
...@@ -400,11 +320,6 @@ Parameters: ...@@ -400,11 +320,6 @@ Parameters:
+ `id` (required) - The ID of the project + `id` (required) - The ID of the project
Return values:
+ `200 Ok` on success and a list of branches
+ `404 Not Found` if project is not found
### List single branch ### List single branch
...@@ -419,11 +334,6 @@ Parameters: ...@@ -419,11 +334,6 @@ Parameters:
+ `id` (required) - The ID of the project. + `id` (required) - The ID of the project.
+ `branch` (required) - The name of the branch. + `branch` (required) - The name of the branch.
Return values:
+ `200 Ok` on success
+ `404 Not Found` if either project with ID or branch could not be found
### Protect single branch ### Protect single branch
...@@ -438,11 +348,6 @@ Parameters: ...@@ -438,11 +348,6 @@ Parameters:
+ `id` (required) - The ID of the project. + `id` (required) - The ID of the project.
+ `branch` (required) - The name of the branch. + `branch` (required) - The name of the branch.
Return values:
+ `200 Ok` on success
+ `404 Not Found` if either project or branch could not be found
### Unprotect single branch ### Unprotect single branch
...@@ -457,11 +362,6 @@ Parameters: ...@@ -457,11 +362,6 @@ Parameters:
+ `id` (required) - The ID of the project. + `id` (required) - The ID of the project.
+ `branch` (required) - The name of the branch. + `branch` (required) - The name of the branch.
Return values:
+ `200 Ok` on success
+ `404 Not Found` if either project or branch could not be found
### List tags ### List tags
...@@ -475,11 +375,6 @@ Parameters: ...@@ -475,11 +375,6 @@ Parameters:
+ `id` (required) - The ID of the project + `id` (required) - The ID of the project
Return values:
+ `200 Ok` on success and a list of tags
+ `404 Not Found` if project with id not found
### List commits ### List commits
...@@ -517,11 +412,6 @@ Parameters: ...@@ -517,11 +412,6 @@ Parameters:
+ `id` (required) - The ID of the project + `id` (required) - The ID of the project
Return values:
+ `200 Ok` on success and the list of snippets
+ `404 Not Found` if project with id not found
### List single snippet ### List single snippet
...@@ -536,11 +426,6 @@ Parameters: ...@@ -536,11 +426,6 @@ Parameters:
+ `id` (required) - The ID of the project + `id` (required) - The ID of the project
+ `snippet_id` (required) - The ID of the snippet + `snippet_id` (required) - The ID of the snippet
Return values:
+ `200 Ok` on success and the project snippet
+ `404 Not Found` if project ID or snippet ID not found
### Create snippet ### Create snippet
...@@ -558,13 +443,6 @@ Parameters: ...@@ -558,13 +443,6 @@ Parameters:
+ `code` (required) - The content of the snippet + `code` (required) - The content of the snippet
+ `lifetime` (optional) - The expiration date of a snippet + `lifetime` (optional) - The expiration date of a snippet
Return values:
+ `201 Created` on success and the new snippet
+ `400 Bad Request` if one of the required attributes is missing
+ `401 Unauthorized` if it is not allowed to post a new snippet
+ `404 Not Found` if the project ID is not found
### Update snippet ### Update snippet
...@@ -583,12 +461,6 @@ Parameters: ...@@ -583,12 +461,6 @@ Parameters:
+ `lifetime` (optional) - The new expiration date of the snippet + `lifetime` (optional) - The new expiration date of the snippet
+ `code` (optional) - The content of the snippet + `code` (optional) - The content of the snippet
Return values:
+ `200 Ok` on success and the content of the updated snippet
+ `401 Unauthorized` if the user is not allowed to modify the snippet
+ `404 Not Found` if project ID or snippet ID is not found
## Delete snippet ## Delete snippet
...@@ -604,8 +476,3 @@ Paramaters: ...@@ -604,8 +476,3 @@ Paramaters:
+ `id` (required) - The ID of the project + `id` (required) - The ID of the project
+ `snippet_id` (required) - The ID of the snippet + `snippet_id` (required) - The ID of the snippet
Return values:
+ `200 Ok` on success, if the snippet got deleted it is returned, if not available then an empty JSON response
+ `401 Unauthorized` if the user is not allowed to remove the snippet
+ `404 Not Found` if the project ID not found
...@@ -39,12 +39,6 @@ Parameters: ...@@ -39,12 +39,6 @@ Parameters:
] ]
``` ```
Return values:
+ `200 Ok`on success and a list of repository branches for the project
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project with ID not found
## Get single repository branch ## Get single repository branch
...@@ -86,13 +80,6 @@ Parameters: ...@@ -86,13 +80,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the repository branch
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if the project ID or branch not found
## Protect repository branch ## Protect repository branch
...@@ -135,13 +122,6 @@ Parameters: ...@@ -135,13 +122,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the updated repository branch
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if the the project ID or branch not found
## Unprotect repository branch ## Unprotect repository branch
...@@ -184,13 +164,6 @@ Parameters: ...@@ -184,13 +164,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the updated repository branch
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if the project ID or the branch not found
## List project repository tags ## List project repository tags
...@@ -231,12 +204,6 @@ Parameters: ...@@ -231,12 +204,6 @@ Parameters:
] ]
``` ```
Return values:
+ `200 Ok` on success and the list of repository tags
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if the project ID not found
## List repository commits ## List repository commits
...@@ -274,12 +241,6 @@ Parameters: ...@@ -274,12 +241,6 @@ Parameters:
] ]
``` ```
Return values:
+ `200 Ok` on success and a list of commits
+ `401 Unauthorized` if the user is not authenticated
+ `404 Not Found` if the project ID not found
## Raw blob content ## Raw blob content
...@@ -294,11 +255,3 @@ Parameters: ...@@ -294,11 +255,3 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `sha` (required) - The commit or branch name + `sha` (required) - The commit or branch name
+ `filepath` (required) - The path the file + `filepath` (required) - The path the file
Return values:
+ `200 Ok` on success and the raw content of the file
+ `400 Bad Request` if required attribute filepath is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or sha commit or branch name not found
...@@ -21,8 +21,3 @@ Parameters: ...@@ -21,8 +21,3 @@ Parameters:
"blocked": true "blocked": true
} }
``` ```
Return values:
+ `201 Created` on success
+ `401 Unauthorized` if the authentication process failed, e.g. invalid password or attribute not given
...@@ -10,11 +10,6 @@ Parameters: ...@@ -10,11 +10,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
Return values:
+ `200 Ok` on success and a list of project snippets
+ `401 Unauthorized` if user is not authenticated
## Single snippet ## Single snippet
...@@ -48,12 +43,6 @@ Parameters: ...@@ -48,12 +43,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the project snippet
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if snippet ID not found
## Create new snippet ## Create new snippet
...@@ -71,13 +60,6 @@ Parameters: ...@@ -71,13 +60,6 @@ Parameters:
+ `lifetime` (optional) - The expiration date of a snippet + `lifetime` (optional) - The expiration date of a snippet
+ `code` (required) - The content of a snippet + `code` (required) - The content of a snippet
Return values:
+ `201 Created` if snippet was successfully created and the snippet as JSON payload
+ `400 Bad Request` if one of the required attributes is not given
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Edit snippet ## Edit snippet
...@@ -96,12 +78,6 @@ Parameters: ...@@ -96,12 +78,6 @@ Parameters:
+ `lifetime` (optional) - The expiration date of a snippet + `lifetime` (optional) - The expiration date of a snippet
+ `code` (optional) - The content of a snippet + `code` (optional) - The content of a snippet
Return values:
+ `200 Ok` on success and the updated project snippet
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Delete snippet ## Delete snippet
...@@ -117,12 +93,6 @@ Parameters: ...@@ -117,12 +93,6 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `snippet_id` (required) - The ID of a project's snippet + `snippet_id` (required) - The ID of a project's snippet
Return values:
+ `200 Ok` on success and if the snippet was deleted its content
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID not found
## Snippet content ## Snippet content
...@@ -136,9 +106,3 @@ Parameters: ...@@ -136,9 +106,3 @@ Parameters:
+ `id` (required) - The ID of a project + `id` (required) - The ID of a project
+ `snippet_id` (required) - The ID of a project's snippet + `snippet_id` (required) - The ID of a project's snippet
Return values:
+ `200 Ok` on success and the raw snippet
+ `401 Unauthorized` if user is not authenticated
+ `404 Not Found` if project ID or snippet ID is not found
\ No newline at end of file
...@@ -43,11 +43,6 @@ GET /users ...@@ -43,11 +43,6 @@ GET /users
] ]
``` ```
Return values:
+ `200 Ok` on success and a list with all users
+ `401 Unauthorized` if user is not allowed to access the list
## Single user ## Single user
...@@ -80,12 +75,6 @@ Parameters: ...@@ -80,12 +75,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the user entry
+ `401 Unauthorized` if it is not allowed to access the user
+ `404 Not Found` if the user with ID is not found
## User creation ## User creation
...@@ -109,15 +98,6 @@ Parameters: ...@@ -109,15 +98,6 @@ Parameters:
+ `provider` (optional) - External provider name + `provider` (optional) - External provider name
+ `bio` (optional) - User's bio + `bio` (optional) - User's bio
Return values:
+ `201 Created` on success and returns the new user
+ `400 Bad Request` if one of the required attributes is missing from the request
+ `401 Unauthorized` if the user is not authorized
+ `403 Forbidden` if the user is not allowed to create a new user (must be admin)
+ `404 Not Found` if something else fails
+ `409 Conflict` if a user with the same email address or username already exists
## User modification ## User modification
...@@ -141,13 +121,6 @@ Parameters: ...@@ -141,13 +121,6 @@ Parameters:
+ `provider` - External provider name + `provider` - External provider name
+ `bio` - User's bio + `bio` - User's bio
Return values:
+ `200 Ok` on success and returns the new user
+ `401 Unauthorized` if the user is not authorized
+ `403 Forbidden` if the user is not allowed to create a new user (must be admin)
+ `404 Not Found` if something else fails
Note, at the moment this method does only return a 404 error, even in cases where a 409 (Conflict) would 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 exsisting one. be more appropriate, e.g. when renaming the email address to some exsisting one.
...@@ -166,13 +139,6 @@ Parameters: ...@@ -166,13 +139,6 @@ Parameters:
+ `id` (required) - The ID of the user + `id` (required) - The ID of the user
Return values:
+ `200 Ok` on success and returns the deleted user
+ `401 Unauthorized` if the user is not authorized
+ `403 Forbidden` if the user is not allowed to create a new user (must be admin)
+ `404 Not Found` if user with ID not found or something else fails
## Current user ## Current user
...@@ -199,12 +165,6 @@ GET /user ...@@ -199,12 +165,6 @@ GET /user
} }
``` ```
Return values:
+ `200 Ok` on success and returns the current user
+ `401 Unauthorized` if the user is not authorized
+ `404 Not Found` if something else fails
## List SSH keys ## List SSH keys
...@@ -237,12 +197,6 @@ Parameters: ...@@ -237,12 +197,6 @@ Parameters:
+ **none** + **none**
Return values:
+ `200 Ok` on success and a list of ssh keys
+ `401 Unauthorized` if the user is not authenticated
+ `404 Not Found` if something else fails
## Single SSH key ## Single SSH key
...@@ -266,12 +220,6 @@ Parameters: ...@@ -266,12 +220,6 @@ Parameters:
} }
``` ```
Return values:
+ `200 Ok` on success and the ssh key with ID
+ `401 Unauthorized` if it is not allowed to access the user
+ `404 Not Found` if the ssh key with ID not found
## Add SSH key ## Add SSH key
...@@ -286,13 +234,6 @@ Parameters: ...@@ -286,13 +234,6 @@ Parameters:
+ `title` (required) - new SSH Key's title + `title` (required) - new SSH Key's title
+ `key` (required) - new SSH key + `key` (required) - new SSH key
Return values:
+ `201 Created` on success and the added key
+ `400 Bad Request` if one of the required attributes is not given
+ `401 Unauthorized` if user is not authorized to add ssh key
+ `404 Not Found` if something else fails
## Delete SSH key ## Delete SSH key
...@@ -307,8 +248,3 @@ Parameters: ...@@ -307,8 +248,3 @@ Parameters:
+ `id` (required) - SSH key ID + `id` (required) - SSH key ID
Return values:
+ `200 Ok` on success
+ `401 Unauthorized` if user is not allowed to delete they key
+ `404 Not Found` if something else fails
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