Commit 68d146b4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve api docs

parent b05600f2
class HelpController < ApplicationController class HelpController < ApplicationController
def index def index
end end
def api
@category = params[:category]
@category = "README" if @category.blank?
if File.exists?(Rails.root.join('doc', 'api', @category + '.md'))
render 'api'
else
not_found!
end
end
end end
.row
.span3
= link_to help_path, class: 'btn append-bottom-20 btn-small' do
%i.icon-angle-left
Back to help
%br
%ul.nav.nav-pills.nav-stacked
- %w(README projects project_snippets repositories deploy_keys users session issues milestones notes system_hooks).each do |file|
%li{class: file == @category ? 'active' : nil}
= link_to file.titleize, help_api_file_path(file)
.span9.pull-right
= yield
= render layout: 'help/layout' do = render layout: 'help/api_layout' do
%h3.page_title API %h3.page_title
%span.light API
%span
\/
= @category.titleize
%br %br
%ul.nav.nav-tabs.log-tabs.nav-small-tabs
%li.active
= link_to "README", "#README", 'data-toggle' => 'tab'
%li
= link_to "Projects", "#projects", 'data-toggle' => 'tab'
%li
= link_to "Snippets", "#snippets", 'data-toggle' => 'tab'
%li
= link_to "Repositories", "#repositories", 'data-toggle' => 'tab'
%li
= link_to "Users", "#users", 'data-toggle' => 'tab'
%li
= link_to "Session", "#session", 'data-toggle' => 'tab'
%li
= link_to "Issues", "#issues", 'data-toggle' => 'tab'
%li
= link_to "Milestones", "#milestones", 'data-toggle' => 'tab'
%li
= link_to "Notes", "#notes", 'data-toggle' => 'tab'
%li
= link_to "System Hooks", "#system_hooks", 'data-toggle' => 'tab'
.tab-content
.tab-pane.active#README
.file_holder
.file_title
%i.icon-file
README
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "README.md"))
.tab-pane#projects
.file_holder
.file_title
%i.icon-file
Projects
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "projects.md"))
.tab-pane#snippets
.file_holder
.file_title
%i.icon-file
Projects Snippets
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "snippets.md"))
.tab-pane#repositories
.file_holder
.file_title
%i.icon-file
Projects
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "repositories.md"))
.tab-pane#users
.file_holder
.file_title
%i.icon-file
Users
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "users.md"))
.tab-pane#session
.file_holder
.file_title
%i.icon-file
Session
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "session.md"))
.tab-pane#issues
.file_holder
.file_title
%i.icon-file
Issues
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "issues.md"))
.tab-pane#milestones
.file_holder
.file_title
%i.icon-file
Milestones
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "milestones.md"))
.tab-pane#notes
.file_holder
.file_title
%i.icon-file
Notes
.file_content.wiki
= preserve do
= markdown File.read(Rails.root.join("doc", "api", "notes.md"))
.tab-pane#system_hooks
.file_holder .file_holder
.file_title .file_title
%i.icon-file %i.icon-file
System Hooks = @category
.file_content.wiki .file_content.wiki
= preserve do = preserve do
= markdown File.read(Rails.root.join("doc", "api", "system_hooks.md")) = markdown File.read(Rails.root.join("doc", "api", "#{@category}.md"))
...@@ -29,6 +29,7 @@ Gitlab::Application.routes.draw do ...@@ -29,6 +29,7 @@ Gitlab::Application.routes.draw do
# #
get 'help' => 'help#index' get 'help' => 'help#index'
get 'help/api' => 'help#api' get 'help/api' => 'help#api'
get 'help/api/:category' => 'help#api', as: 'help_api_file'
get 'help/markdown' => 'help#markdown' get 'help/markdown' => 'help#markdown'
get 'help/permissions' => 'help#permissions' get 'help/permissions' => 'help#permissions'
get 'help/public_access' => 'help#public_access' get 'help/public_access' => 'help#public_access'
......
## Deploy Keys
### List deploy keys
Get a list of a project's deploy keys.
```
GET /projects/:id/keys
```
Parameters:
+ `id` (required) - The ID of the project
```json
[
{
"id": 1,
"title" : "Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
},
{
"id": 3,
"title" : "Another Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
}
]
```
### Single deploy key
Get a single key.
```
GET /projects/:id/keys/:key_id
```
Parameters:
+ `id` (required) - The ID of the project
+ `key_id` (required) - The ID of the deploy key
```json
{
"id": 1,
"title" : "Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
}
```
### Add deploy key
Creates a new deploy key for a project.
If deploy key already exists in another project - it will be joined to project but only if original one was is accessible by same user
```
POST /projects/:id/keys
```
Parameters:
+ `id` (required) - The ID of the project
+ `title` (required) - New deploy key's title
+ `key` (required) - New deploy key
### Delete deploy key
Delete a deploy key from a project
```
DELETE /projects/:id/keys/:key_id
```
Parameters:
+ `id` (required) - The ID of the project
+ `key_id` (required) - The ID of the deploy key
...@@ -381,126 +381,3 @@ Parameters: ...@@ -381,126 +381,3 @@ 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.
### List tags
Lists all tags of a project.
```
GET /projects/:id/repository/tags
```
Parameters:
+ `id` (required) - The ID of the project
### List commits
Lists all commits with pagination. If the optional `ref_name` name is not given the commits of
the default branch (usually master) are returned.
```
GET /projects/:id/repository/commits
```
Parameters:
+ `id` (required) - The Id of the project
+ `ref_name` (optional) - The name of a repository branch or tag
+ `page` (optional) - The page of commits to return (`0` default)
+ `per_page` (optional) - The number of commits per page (`20` default)
Returns values:
+ `200 Ok` on success and a list with commits
+ `404 Not Found` if project with id or the branch with `ref_name` not found
## Deploy Keys
### List deploy keys
Get a list of a project's deploy keys.
```
GET /projects/:id/keys
```
Parameters:
+ `id` (required) - The ID of the project
```json
[
{
"id": 1,
"title" : "Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
},
{
"id": 3,
"title" : "Another Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
}
]
```
### Single deploy key
Get a single key.
```
GET /projects/:id/keys/:key_id
```
Parameters:
+ `id` (required) - The ID of the project
+ `key_id` (required) - The ID of the deploy key
```json
{
"id": 1,
"title" : "Public key"
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
}
```
### Add deploy key
Creates a new deploy key for a project.
```
POST /projects/:id/keys
```
Parameters:
+ `id` (required) - The ID of the project
+ `title` (required) - New deploy key's title
+ `key` (required) - New deploy key
### Delete deploy key
Delete a deploy key from a project
```
DELETE /projects/:id/keys/:key_id
```
Parameters:
+ `id` (required) - The ID of the project
+ `key_id` (required) - The ID of the deploy key
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