diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-09-03 12:48:51 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-09-03 12:48:51 +0400 |
commit | cc03600b22342a541ab1b4617eaf4d38d6d2d1da (patch) | |
tree | 5e497240ebd41b8a148173b11aa1c8b9ee57ba16 /lib | |
parent | 6ec909cfd038c8b6510d14144b28425c599fc1bd (diff) | |
parent | 2bd1682ab469687f0dce719f1417c9b03fa3a8db (diff) |
Merge pull request #1347 from AlexDenisov/api_project_creation
API for new project creation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/projects.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index eb23641c605..f42849cd2f2 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -23,6 +23,27 @@ module Gitlab present user_project, with: Entities::Project end + # Create new project + # + # Parameters: + # name (required) - name for new project + # code (optional) - code for new project, uses project name if not set + # path (optional) - path for new project, uses project name if not set + # Example Request + # POST /projects + post do + project = {} + project[:name] = params[:name] + project[:code] = params[:code] || project[:name] + project[:path] = params[:path] || project[:name] + @project = Project.create_by_user(project, current_user) + if @project.saved? + present @project, with: Entities::Project + else + error!({'message' => '404 Not found'}, 404) + end + end + # Get a project repository branches # # Parameters: |