API on Projects creation implemented
This commit is contained in:
parent
65abd8b20a
commit
c1173e2707
2 changed files with 58 additions and 0 deletions
|
@ -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, if not set used name
|
||||
# path (optional) - oath for new project, if not set used name
|
||||
# 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue