From 441e6dcf0d4d09a713ae6bc7bb47eddc76ad9f48 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 11 Feb 2014 11:44:08 +0100 Subject: Update api project documentation to include project name as attribute. --- doc/api/projects.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'doc/api') diff --git a/doc/api/projects.md b/doc/api/projects.md index 559553a1108..9f2945d0701 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -162,7 +162,7 @@ GET /projects/:id/events Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project ```json @@ -290,7 +290,7 @@ GET /projects/:id/members Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `query` (optional) - Query string to search for members @@ -304,7 +304,7 @@ GET /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `user_id` (required) - The ID of a user ```json @@ -332,7 +332,7 @@ POST /projects/:id/members Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `user_id` (required) - The ID of a user to add + `access_level` (required) - Project access level @@ -347,7 +347,7 @@ PUT /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `user_id` (required) - The ID of a team member + `access_level` (required) - Project access level @@ -362,7 +362,7 @@ DELETE /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `user_id` (required) - The ID of a team member This method is idempotent and can be called multiple times with the same parameters. @@ -383,7 +383,7 @@ GET /projects/:id/hooks Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project ### Get project hook @@ -396,7 +396,7 @@ GET /projects/:id/hooks/:hook_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `hook_id` (required) - The ID of a project hook ```json @@ -422,7 +422,7 @@ POST /projects/:id/hooks Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `url` (required) - The hook URL + `push_events` - Trigger hook on push events + `issues_events` - Trigger hook on issues events @@ -439,7 +439,7 @@ PUT /projects/:id/hooks/:hook_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `hook_id` (required) - The ID of a project hook + `url` (required) - The hook URL + `push_events` - Trigger hook on push events @@ -458,7 +458,7 @@ DELETE /projects/:id/hooks/:hook_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `hook_id` (required) - The ID of hook to delete Note the JSON response differs if the hook is available or not. If the project hook @@ -477,7 +477,7 @@ GET /projects/:id/repository/branches Parameters: -+ `id` (required) - The ID of the project ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project ```json [ @@ -539,7 +539,7 @@ GET /projects/:id/repository/branches/:branch Parameters: -+ `id` (required) - The ID of the project. ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `branch` (required) - The name of the branch. @@ -553,7 +553,7 @@ PUT /projects/:id/repository/branches/:branch/protect Parameters: -+ `id` (required) - The ID of the project. ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `branch` (required) - The name of the branch. @@ -567,7 +567,7 @@ PUT /projects/:id/repository/branches/:branch/unprotect Parameters: -+ `id` (required) - The ID of the project. ++ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project + `branch` (required) - The name of the branch. -- cgit v1.2.1 From dac0e2f17411e23f06ddfef7fb737716e82f0518 Mon Sep 17 00:00:00 2001 From: dosire Date: Fri, 14 Feb 2014 11:13:52 +0100 Subject: Add namespace for projects to docs. --- doc/api/projects.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/api') diff --git a/doc/api/projects.md b/doc/api/projects.md index 9f2945d0701..12e0c47ee6e 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -231,6 +231,7 @@ POST /projects Parameters: + `name` (required) - new project name ++ `namespace_id` (optional) - namespace for the new project (defaults to user) + `description` (optional) - short project description + `issues_enabled` (optional) + `wall_enabled` (optional) @@ -254,6 +255,7 @@ Parameters: + `user_id` (required) - user_id of owner + `name` (required) - new project name ++ `namespace_id` (optional) - namespace for the new project (defaults to user) + `description` (optional) - short project description + `default_branch` (optional) - 'master' by default + `issues_enabled` (optional) -- cgit v1.2.1 From ddbe978041753d7851780165f8c6c66865570862 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 18 Feb 2014 12:27:02 +0200 Subject: Complete api files CRUD Signed-off-by: Dmitriy Zaporozhets --- doc/api/README.md | 1 + doc/api/repositories.md | 41 ------------------ doc/api/repository_files.md | 102 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 41 deletions(-) create mode 100644 doc/api/repository_files.md (limited to 'doc/api') 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 + -- cgit v1.2.1 From 6cf39fe10ddf6f90a17d52ba6b50425f58215eeb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 18 Feb 2014 12:41:21 +0200 Subject: Extract commits API to separate file Signed-off-by: Dmitriy Zaporozhets --- doc/api/README.md | 1 + doc/api/commits.md | 95 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/api/repositories.md | 93 ----------------------------------------------- 3 files changed, 96 insertions(+), 93 deletions(-) create mode 100644 doc/api/commits.md (limited to 'doc/api') diff --git a/doc/api/README.md b/doc/api/README.md index f13f319a843..850666953a3 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -128,6 +128,7 @@ But when you want to create a link to web page - use `http:://host/project/issu + [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 70e297f1bcb..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. -- cgit v1.2.1 From 0007db8352fa56be06d663f4046a2b5602e51bc0 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 18 Feb 2014 15:38:07 +0100 Subject: Doesn't exist for user endpoint. --- doc/api/projects.md | 1 - 1 file changed, 1 deletion(-) (limited to 'doc/api') diff --git a/doc/api/projects.md b/doc/api/projects.md index 12e0c47ee6e..e795298c672 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -255,7 +255,6 @@ Parameters: + `user_id` (required) - user_id of owner + `name` (required) - new project name -+ `namespace_id` (optional) - namespace for the new project (defaults to user) + `description` (optional) - short project description + `default_branch` (optional) - 'master' by default + `issues_enabled` (optional) -- cgit v1.2.1