summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-18 14:15:40 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-18 14:15:40 +0000
commit8686d09d3e9e53089f7d3f11d74f0368f76a2aa2 (patch)
tree9702483393e25eabd403b98d3af2de0a0e0cc75a /doc/api
parent8a55636f8974d73c097a52721e2208cea727bc17 (diff)
parent6cf39fe10ddf6f90a17d52ba6b50425f58215eeb (diff)
downloadgitlab-ce-8686d09d3e9e53089f7d3f11d74f0368f76a2aa2.tar.gz
Merge branch 'feature/api_fle_encoded' into 'master'
Complete api files CRUD Adds ability to read file from repository with content encoded with Base64.
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/README.md2
-rw-r--r--doc/api/commits.md95
-rw-r--r--doc/api/repositories.md134
-rw-r--r--doc/api/repository_files.md102
4 files changed, 199 insertions, 134 deletions
diff --git a/doc/api/README.md b/doc/api/README.md
index 517a9fae6f6..850666953a3 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -127,6 +127,8 @@ 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)
++ [Commits](commits.md)
+ [Merge Requests](merge_requests.md)
+ [Issues](issues.md)
+ [Milestones](milestones.md)
diff --git a/doc/api/commits.md b/doc/api/commits.md
new file mode 100644
index 00000000000..69b44a2e83b
--- /dev/null
+++ b/doc/api/commits.md
@@ -0,0 +1,95 @@
+# Commits API
+
+## List repository commits
+
+Get a list of repository commits in a project.
+
+```
+GET /projects/:id/repository/commits
+```
+
+Parameters:
+
++ `id` (required) - The ID of a project
++ `ref_name` (optional) - The name of a repository branch or tag or if not given the default branch
+
+```json
+[
+ {
+ "id": "ed899a2f4b50b4370feeea94676502b42383c746",
+ "short_id": "ed899a2f4b5",
+ "title": "Replace sanitize with escape once",
+ "author_name": "Dmitriy Zaporozhets",
+ "author_email": "dzaporozhets@sphereconsultinginc.com",
+ "created_at": "2012-09-20T11:50:22+03:00"
+ },
+ {
+ "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
+ "short_id": "6104942438c",
+ "title": "Sanitize for network graph",
+ "author_name": "randx",
+ "author_email": "dmitriy.zaporozhets@gmail.com",
+ "created_at": "2012-09-20T09:06:12+03:00"
+ }
+]
+```
+
+## Get a single commit
+
+Get a specific commit identified by the commit hash or name of a branch or tag.
+
+```
+GET /projects/:id/repository/commits/:sha
+```
+
+Parameters:
+
++ `id` (required) - The ID of a project
++ `sha` (required) - The commit hash or name of a repository branch or tag
+
+```json
+{
+ "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
+ "short_id": "6104942438c",
+ "title": "Sanitize for network graph",
+ "author_name": "randx",
+ "author_email": "dmitriy.zaporozhets@gmail.com",
+ "created_at": "2012-09-20T09:06:12+03:00",
+ "committed_date": "2012-09-20T09:06:12+03:00",
+ "authored_date": "2012-09-20T09:06:12+03:00",
+ "parent_ids" : [
+ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
+ ]
+}
+```
+
+
+## Get the diff of a commit
+
+Get the diff of a commit in a project.
+
+```
+GET /projects/:id/repository/commits/:sha/diff
+```
+
+Parameters:
+
++ `id` (required) - The ID of a project
++ `sha` (required) - The name of a repository branch or tag or if not given the default branch
+
+```json
+[
+ {
+ "diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files",
+ "new_path": "doc/update/5.4-to-6.0.md",
+ "old_path": "doc/update/5.4-to-6.0.md",
+ "a_mode": null,
+ "b_mode": "100644",
+ "new_file": false,
+ "renamed_file": false,
+ "deleted_file": false
+ }
+]
+```
+
+
diff --git a/doc/api/repositories.md b/doc/api/repositories.md
index 01607263008..65ea3615354 100644
--- a/doc/api/repositories.md
+++ b/doc/api/repositories.md
@@ -204,99 +204,6 @@ Parameters:
]
```
-
-## List repository commits
-
-Get a list of repository commits in a project.
-
-```
-GET /projects/:id/repository/commits
-```
-
-Parameters:
-
-+ `id` (required) - The ID of a project
-+ `ref_name` (optional) - The name of a repository branch or tag or if not given the default branch
-
-```json
-[
- {
- "id": "ed899a2f4b50b4370feeea94676502b42383c746",
- "short_id": "ed899a2f4b5",
- "title": "Replace sanitize with escape once",
- "author_name": "Dmitriy Zaporozhets",
- "author_email": "dzaporozhets@sphereconsultinginc.com",
- "created_at": "2012-09-20T11:50:22+03:00"
- },
- {
- "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
- "short_id": "6104942438c",
- "title": "Sanitize for network graph",
- "author_name": "randx",
- "author_email": "dmitriy.zaporozhets@gmail.com",
- "created_at": "2012-09-20T09:06:12+03:00"
- }
-]
-```
-
-## Get a single commit
-
-Get a specific commit identified by the commit hash or name of a branch or tag.
-
-```
-GET /projects/:id/repository/commits/:sha
-```
-
-Parameters:
-
-+ `id` (required) - The ID of a project
-+ `sha` (required) - The commit hash or name of a repository branch or tag
-
-```json
-{
- "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
- "short_id": "6104942438c",
- "title": "Sanitize for network graph",
- "author_name": "randx",
- "author_email": "dmitriy.zaporozhets@gmail.com",
- "created_at": "2012-09-20T09:06:12+03:00",
- "committed_date": "2012-09-20T09:06:12+03:00",
- "authored_date": "2012-09-20T09:06:12+03:00",
- "parent_ids" : [
- "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
- ]
-}
-```
-
-
-## Get the diff of a commit
-
-Get the diff of a commit in a project.
-
-```
-GET /projects/:id/repository/commits/:sha/diff
-```
-
-Parameters:
-
-+ `id` (required) - The ID of a project
-+ `sha` (required) - The name of a repository branch or tag or if not given the default branch
-
-```json
-[
- {
- "diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files",
- "new_path": "doc/update/5.4-to-6.0.md",
- "old_path": "doc/update/5.4-to-6.0.md",
- "a_mode": null,
- "b_mode": "100644",
- "new_file": false,
- "renamed_file": false,
- "deleted_file": false
- }
-]
-```
-
## List repository tree
Get a list of repository files and directories in a project.
@@ -388,44 +295,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
+