diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-18 12:27:02 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-18 12:27:02 +0200 |
commit | ddbe978041753d7851780165f8c6c66865570862 (patch) | |
tree | e063ebab3b86a4a60b2b7b7f6a3981c303c2e99b /doc | |
parent | 87a449f264684551d0b9cdfa9ed2d32f21110adb (diff) | |
download | gitlab-ce-ddbe978041753d7851780165f8c6c66865570862.tar.gz |
Complete api files CRUD
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/README.md | 1 | ||||
-rw-r--r-- | doc/api/repositories.md | 41 | ||||
-rw-r--r-- | doc/api/repository_files.md | 102 |
3 files changed, 103 insertions, 41 deletions
diff --git a/doc/api/README.md b/doc/api/README.md index 517a9fae6f6..f13f319a843 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -127,6 +127,7 @@ But when you want to create a link to web page - use `http:://host/project/issu + [Projects](projects.md) + [Project Snippets](project_snippets.md) + [Repositories](repositories.md) ++ [Repository Files](repository_files.md) + [Merge Requests](merge_requests.md) + [Issues](issues.md) + [Milestones](milestones.md) diff --git a/doc/api/repositories.md b/doc/api/repositories.md index 01607263008..70e297f1bcb 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -388,44 +388,3 @@ GET /projects/:id/repository/archive Parameters: + `id` (required) - The ID of a project + `sha` (optional) - The commit sha to download defaults to the tip of the default branch - - -## Create new file in repository - -``` -POST /projects/:id/repository/files -``` - -Parameters: - -+ `file_path` (optional) - Full path to new file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `encoding` (optional) - 'text' or 'base64'. Text is default. -+ `content` (required) - File content -+ `commit_message` (required) - Commit message - -## Update existing file in repository - -``` -PUT /projects/:id/repository/files -``` - -Parameters: - -+ `file_path` (required) - Full path to file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `encoding` (optional) - 'text' or 'base64'. Text is default. -+ `content` (required) - New file content -+ `commit_message` (required) - Commit message - -## Delete existing file in repository - -``` -DELETE /projects/:id/repository/files -``` - -Parameters: - -+ `file_path` (required) - Full path to file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `commit_message` (required) - Commit message diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md new file mode 100644 index 00000000000..cafab8c828f --- /dev/null +++ b/doc/api/repository_files.md @@ -0,0 +1,102 @@ +# CRUD for repository files + +## Create, read, update and delete repository files using this API + +- - - + +## Get file from repository + +Allows you to receive information about file in repository like name, size, content. +Note that file content is Base64 encoded. + +``` +GET /projects/:id/repository/files +``` + +Example response: + +```json +{ + "file_name": "key.rb", + "file_path": "app/models/key.rb", + "size": 1476, + "encoding": "base64", + "content": "IyA9PSBTY2hlbWEgSW5mb3...", + "ref": "master", + "blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83", + "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50" +} +``` + +Parameters: + ++ `file_path` (required) - Full path to new file. Ex. lib/class.rb ++ `ref` (required) - The name of branch, tag or commit + +## Create new file in repository + +``` +POST /projects/:id/repository/files +``` + +Example response: + +```json +{ + "file_name": "app/project.rb", + "branch_name": "master", +} +``` + +Parameters: + ++ `file_path` (required) - Full path to new file. Ex. lib/class.rb ++ `branch_name` (required) - The name of branch ++ `encoding` (optional) - 'text' or 'base64'. Text is default. ++ `content` (required) - File content ++ `commit_message` (required) - Commit message + +## Update existing file in repository + +``` +PUT /projects/:id/repository/files +``` + +Example response: + +```json +{ + "file_name": "app/project.rb", + "branch_name": "master", +} +``` + +Parameters: + ++ `file_path` (required) - Full path to file. Ex. lib/class.rb ++ `branch_name` (required) - The name of branch ++ `encoding` (optional) - 'text' or 'base64'. Text is default. ++ `content` (required) - New file content ++ `commit_message` (required) - Commit message + +## Delete existing file in repository + +``` +DELETE /projects/:id/repository/files +``` + +Example response: + +```json +{ + "file_name": "app/project.rb", + "branch_name": "master", +} +``` + +Parameters: + ++ `file_path` (required) - Full path to file. Ex. lib/class.rb ++ `branch_name` (required) - The name of branch ++ `commit_message` (required) - Commit message + |