2015-05-18 02:25:53 +00:00
swagger : "2.0"
info :
version : 1.0 .0
title : Drone API
license :
name : Creative Commons 4.0 International
url : "http://creativecommons.org/licenses/by/4.0/"
2015-07-01 09:23:21 +00:00
2015-05-18 02:25:53 +00:00
host : "localhost:8080"
basePath : /api
schemes :
- http
2015-06-23 07:12:21 +00:00
- https
consumes :
- application/json
produces :
- application/json
2015-07-01 09:23:21 +00:00
#
# Operation tags
#
tags :
2015-07-02 06:22:05 +00:00
- name : Repos
- name : Builds
- name : User
- name : Users
2015-07-01 09:23:21 +00:00
#
# Security Definitions
#
2015-06-23 07:12:21 +00:00
security :
- accessToken : [ ]
securityDefinitions :
accessToken :
type : apiKey
in : query
name : access_token
2015-07-01 09:23:21 +00:00
#
# Endpoint Definitions
#
2015-05-18 02:25:53 +00:00
paths :
2015-07-01 09:23:21 +00:00
#
# Repos Endpoint
#
2015-06-23 07:12:21 +00:00
/repos/{owner}/{name}:
get :
parameters :
- name : owner
in : path
type : string
2015-07-01 09:23:21 +00:00
description : owner of the repository
2015-06-23 07:12:21 +00:00
- name : name
in : path
type : string
2015-07-01 09:23:21 +00:00
description : name of the repository
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- Repos
2015-07-01 09:23:21 +00:00
summary : Get a repo
description : Retrieves the details of a repository.
2015-06-23 07:12:21 +00:00
security :
- accessToken : [ ]
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-06-23 07:12:21 +00:00
schema :
$ref : "#/definitions/Repo"
2015-07-01 09:23:21 +00:00
404 :
description : |
Unable to find the repository.
2015-06-23 18:35:21 +00:00
patch :
parameters :
- name : owner
in : path
type : string
2015-07-01 09:23:21 +00:00
description : owner of the repository
2015-06-23 18:35:21 +00:00
- name : name
in : path
type : string
2015-07-01 09:23:21 +00:00
description : name of the repository
2015-06-24 02:08:18 +00:00
- name : repo
in : body
description : The updated repository JSON
schema :
$ref : '#/definitions/Repo'
2015-07-01 09:23:21 +00:00
example : |
2015-10-06 06:18:10 +00:00
{
"timeout": 60 ,
"private": false ,
"trusted": false ,
"allow_pr": true ,
"allow_push": true ,
"allow_deploys": false ,
"allow_tags": false
}
2015-06-24 02:08:18 +00:00
required : true
tags :
2015-07-02 06:22:05 +00:00
- Repos
2015-07-01 09:23:21 +00:00
summary : Updates a repo
description : Updates the specified repository.
security :
- accessToken : [ ]
responses :
200 :
schema :
$ref : "#/definitions/Repo"
400 :
description : |
Unable to update the repository in the database.
404 :
description : |
Unable to find the repository.
post :
parameters :
- name : owner
in : path
type : string
description : owner of the repository
- name : name
in : path
type : string
description : name of the repository
tags :
2015-07-02 06:22:05 +00:00
- Repos
2015-10-06 06:18:10 +00:00
summary : Activates a repo
description : Activates a repository.
2015-06-23 18:35:21 +00:00
security :
- accessToken : [ ]
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-06-23 18:35:21 +00:00
schema :
$ref : "#/definitions/Repo"
2015-07-01 09:23:21 +00:00
400 :
description : |
Unable to update the Repository record in the database
403 :
description : |
Unable to activate the Repository due to insufficient privileges
404 :
description : |
Unable to retrieve the Repository from the remote system (ie GitHub)
409 :
description : |
Unable to activate the Repository because it is already activate
500 :
description : |
Unable to activate the Repository due to an internal server error. This may indicate a problem adding hooks to the remote system (ie Github), generating SSH deployment keys, or persisting to the database.
2015-06-23 18:35:21 +00:00
delete :
parameters :
- name : owner
in : path
type : string
2015-07-01 09:23:21 +00:00
description : owner of the repository
2015-06-23 18:35:21 +00:00
- name : name
in : path
type : string
2015-07-01 09:23:21 +00:00
description : name of the repository
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- Repos
2015-07-01 09:23:21 +00:00
summary : Delete a repo
description : Permanently deletes a repository. It cannot be undone.
2015-06-23 18:35:21 +00:00
security :
- accessToken : [ ]
2015-07-01 09:23:21 +00:00
responses :
200 :
description : |
Successfully deleted the Repository
400 :
description : |
Unable to remove post-commit hooks from the remote system (ie GitHub)
404 :
description : |
Unable to find the Repository in the database
500 :
description : |
Unable to update the Repository record in the database
2015-08-19 17:53:17 +00:00
#
# Repos Param Encryption Enpoint
# TODO: properly add the input output schema
/repos/{owner}/{name}/encrypt:
post :
parameters :
- name : owner
in : path
type : string
description : owner of the repository
- name : name
in : path
type : string
description : name of the repository
tags :
- Repos
2015-10-06 21:41:55 +00:00
summary : Encrypt repo secrets
description : Encryptes a Yaml file with secret environment variables for secure public storage.
2015-08-19 17:53:17 +00:00
security :
- accessToken : [ ]
responses :
200 :
description : The encrypted parameters.
400 :
description : |
Unable to encrypt the parameters.
404 :
description : |
Unable to find the repository.
2015-07-01 09:23:21 +00:00
#
# Builds Endpoint
#
2015-06-23 18:35:21 +00:00
/repos/{owner}/{name}/builds:
get :
parameters :
- name : owner
in : path
type : string
2015-07-01 09:23:21 +00:00
description : owner of the repository
2015-06-23 18:35:21 +00:00
- name : name
in : path
type : string
2015-07-01 09:23:21 +00:00
description : name of the repository
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- Builds
2015-07-01 09:23:21 +00:00
summary : Get recent builds
2015-06-23 18:35:21 +00:00
description : Returns recent builds for the repository based on name.
security :
- accessToken : [ ]
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-06-23 18:35:21 +00:00
description : The recent builds.
schema :
type : array
items :
$ref : "#/definitions/Build"
2015-07-01 09:23:21 +00:00
404 :
description : |
Unable to find the Repository in the database
2015-06-23 18:35:21 +00:00
/repos/{owner}/{name}/builds/{number}:
get :
parameters :
- name : owner
in : path
type : string
2015-07-01 09:23:21 +00:00
description : owner of the repository
2015-06-23 18:35:21 +00:00
- name : name
in : path
type : string
2015-07-01 09:23:21 +00:00
description : name of the repository
2015-06-23 18:35:21 +00:00
- name : number
in : path
type : integer
2015-07-01 09:23:21 +00:00
description : sequential build number
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- Builds
2015-07-01 09:23:21 +00:00
summary : Get a build
2015-06-23 18:35:21 +00:00
description : Returns the repository build by number.
security :
- accessToken : [ ]
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-06-23 18:35:21 +00:00
description : The build.
schema :
$ref : "#/definitions/Build"
2015-07-01 09:23:21 +00:00
404 :
description : |
2015-07-02 06:22:05 +00:00
Unable to find the Repository or Build
post :
parameters :
- name : owner
in : path
type : string
description : owner of the repository
- name : name
in : path
type : string
description : name of the repository
- name : number
in : path
type : integer
description : sequential build number
tags :
- Builds
summary : Restart a build
description : Restart the a build by number.
security :
- accessToken : [ ]
responses :
200 :
description : Successfully restarted the Build.
schema :
$ref : "#/definitions/Build"
404 :
description : |
Unable to find the Repository or Build.
409 :
description : |
Cannot re-start a Build that is running.
2015-07-01 09:23:21 +00:00
2015-10-06 06:18:10 +00:00
#
# Jobs Endpoint
#
2015-07-02 06:22:05 +00:00
/repos/{owner}/{name}/logs/{number}/{job}:
get :
parameters :
- name : owner
in : path
type : string
description : owner of the repository
- name : name
in : path
type : string
description : name of the repository
- name : number
in : path
type : integer
description : sequential build number
- name : job
in : path
type : integer
description : sequential job number
tags :
- Builds
summary : Get build logs
description : Returns the build logs for a specific job (build step).
produces :
- text/plain
security :
- accessToken : [ ]
responses :
200 :
description : The logs for the requested job.
404 :
description : |
Unable to find the repository, build or job.
2015-07-01 09:23:21 +00:00
2015-10-06 06:18:10 +00:00
delete :
2015-07-01 09:23:21 +00:00
parameters :
- name : owner
in : path
type : string
description : owner of the repository
- name : name
in : path
type : string
description : name of the repository
2015-10-06 06:18:10 +00:00
- name : number
2015-07-01 09:23:21 +00:00
in : path
2015-10-06 06:18:10 +00:00
type : integer
description : sequential build number
- name : job
2015-07-01 09:23:21 +00:00
in : path
2015-10-06 06:18:10 +00:00
type : integer
description : sequential job number
tags :
- Builds
summary : Cancel a Job
description : Cancel the a build job by number.
security :
- accessToken : [ ]
2015-07-02 06:22:05 +00:00
responses :
200 :
2015-10-06 06:18:10 +00:00
description : Successfully cancelled the Job
404 :
description : |
Unable to find the Repository or Job
409 :
description : |
Cannot cancel a Job that is already stopped
2015-07-01 09:23:21 +00:00
#
# User Endpoint
#
2015-05-18 02:25:53 +00:00
/user :
get :
2015-07-01 09:23:21 +00:00
summary : Gets a user
2015-05-18 02:25:53 +00:00
description : Returns the currently authenticated user.
2015-06-23 07:12:21 +00:00
security :
- accessToken : [ ]
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- User
2015-05-18 02:25:53 +00:00
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-05-18 02:25:53 +00:00
description : The currently authenticated user.
schema :
$ref : "#/definitions/User"
patch :
2015-07-01 09:23:21 +00:00
summary : Updates a user
2015-05-18 02:25:53 +00:00
description : Updates the currently authenticated user.
2015-06-24 02:08:18 +00:00
tags :
2015-07-02 06:22:05 +00:00
- User
2015-05-18 02:25:53 +00:00
parameters :
- name : user
in : body
description : Updates to the user.
required : true
schema :
$ref : "#/definitions/User"
responses :
2015-07-01 09:23:21 +00:00
200 :
2015-05-18 02:25:53 +00:00
description : The updated user.
schema :
$ref : "#/definitions/User"
2015-07-01 09:23:21 +00:00
400 :
description : |
Unable to update the user in the database
#
# User Repos
#
/user/repos :
get :
summary : Get user repos
description : |
Retrieve the currently authenticated User's Repository list
tags :
2015-07-02 06:22:05 +00:00
- User
2015-07-01 09:23:21 +00:00
responses :
200 :
schema :
type : array
items :
$ref : "#/definitions/Repo"
400 :
description : |
Unable to retrieve Repository list
#
# Users Endpoint
#
/users :
get :
tags :
2015-07-02 06:22:05 +00:00
- Users
2015-07-01 09:23:21 +00:00
summary : Get all users
description : Returns all registered, active users in the system.
security :
- accessToken : [ ]
responses :
200 :
description : All registered users.
schema :
type : array
items :
$ref : "#/definitions/User"
/users/{login}:
get :
2015-07-02 06:22:05 +00:00
parameters :
- name : login
in : path
type : string
description : user login
tags :
- Users
summary : Get a user
description : Returns a user with the specified login name.
security :
- accessToken : [ ]
responses :
200 :
description : Returns the user.
schema :
$ref : "#/definitions/User"
404 :
description : Cannot find user with matching login.
2015-07-01 09:23:21 +00:00
post :
2015-07-02 06:22:05 +00:00
parameters :
- name : login
in : path
type : string
description : user login to activate
tags :
- Users
summary : Create a user
description : Creates a new user account with the specified external login.
security :
- accessToken : [ ]
responses :
201 :
description : Returns the created user.
schema :
$ref : "#/definitions/User"
400 :
description : |
Error inserting User into the database
2015-07-01 09:23:21 +00:00
patch :
2015-07-02 06:22:05 +00:00
parameters :
- name : login
in : path
type : string
description : user login
- name : user
in : body
description : changes to the user
schema :
$ref : '#/definitions/User'
example : |
{
"email": "octocat@github.com" ,
"admin": false ,
"active": true
}
required : true
tags :
- Users
summary : Update a user
description : Updates an existing user account.
security :
- accessToken : [ ]
responses :
200 :
description : Returns the updated user.
schema :
$ref : "#/definitions/User"
400 :
description : |
Error updating the User in the database
2015-07-01 09:23:21 +00:00
delete :
2015-07-02 06:22:05 +00:00
parameters :
- name : login
in : path
type : string
description : user login
tags :
- Users
summary : Delete a user
description : Deletes the user with the specified login name.
security :
- accessToken : [ ]
responses :
204 :
description : |
Successfully deleted the User
400 :
description : |
Error deleting the User from the database
403 :
description : |
Cannot delete your own User account
404 :
description : |
Cannot find the User
2015-07-01 09:23:21 +00:00
#
# Schema Definitions
#
2015-05-18 02:25:53 +00:00
definitions :
User :
2015-07-01 09:23:21 +00:00
example : |
{
2015-10-06 06:18:10 +00:00
"id": 1 ,
"login": "octocat" ,
2015-07-01 09:23:21 +00:00
"email": "octocat@github.com" ,
2015-09-04 00:21:08 +00:00
"avatar_url": "http://www.gravatar.com/avatar/7194e8d48fa1d2b689f99443b767316c" ,
2015-07-01 09:23:21 +00:00
"admin": false ,
"active": true
}
2015-05-18 02:25:53 +00:00
properties :
2015-09-08 21:32:05 +00:00
id :
type : integer
format : int64
2015-05-18 02:25:53 +00:00
login :
type : string
email :
type : string
2015-09-04 00:21:08 +00:00
avatar_url :
2015-05-18 02:25:53 +00:00
type : string
admin :
type : boolean
active :
type : boolean
2015-10-06 06:18:10 +00:00
2015-05-18 02:25:53 +00:00
Repo :
2015-07-01 09:23:21 +00:00
example : |
{
2015-09-08 21:32:05 +00:00
"id": 1 ,
2015-10-27 20:06:13 +00:00
"scm": "git" ,
2015-10-06 06:18:10 +00:00
"owner": "octocat" ,
"name": "hello-world" ,
"full_name": "octocat/hello-world" ,
"avatar_url": "https://avatars.githubusercontent.com/u/2181346?v=3" ,
"link_url": "https://github.com/octocat/hello-world" ,
"clone_url": "https://github.com/octocat/hello-world.git" ,
"default_branch": "master" ,
"timeout": 60 ,
"private": false ,
"trusted": false ,
"allow_pr": true ,
"allow_push": true ,
"allow_deploys": false ,
"allow_tags": false
2015-07-01 09:23:21 +00:00
}
2015-05-18 02:25:53 +00:00
properties :
2015-09-08 21:32:05 +00:00
id :
type : integer
format : int64
2015-10-27 20:06:13 +00:00
scm :
type : string
2015-05-18 02:25:53 +00:00
owner :
type : string
name :
type : string
2015-06-23 07:12:21 +00:00
full_name :
type : string
2015-10-06 06:18:10 +00:00
avatar_url :
type : string
2015-06-23 07:12:21 +00:00
link_url :
type : string
clone_url :
type : string
default_branch :
type : string
private :
type : boolean
trusted :
type : boolean
timeout :
type : integer
2015-10-06 06:18:10 +00:00
allow_pr :
type : boolean
allow_push :
type : boolean
allow_deploys :
type : boolean
allow_tags :
type : boolean
2015-06-23 07:12:21 +00:00
Build :
2015-07-01 09:23:21 +00:00
example : |
{
2015-10-06 06:18:10 +00:00
"id": 1 ,
2015-07-01 09:23:21 +00:00
"number": 1 ,
2015-10-06 06:18:10 +00:00
"event": "push" ,
2015-07-01 09:23:21 +00:00
"status": "success" ,
2015-10-06 06:18:10 +00:00
"created_at": 1443677151 ,
"enqueued_at": 1443677151 ,
"started_at": 1443677151 ,
"finished_at": 1443677255 ,
"commit": "2deb7e0d0cbac357eeb110c8a2f2f32ce037e0d5" ,
"branch": "master" ,
"ref": "refs/heads/master" ,
"remote": "https://github.com/octocat/hello-world.git" ,
"message": "New line at end of file. --Signed off by Spaceghost" ,
"timestamp": 1443677255 ,
"author": "Spaceghost" ,
"author_avatar": "https://avatars0.githubusercontent.com/u/251370?v=3" ,
"author_email": "octocat@github.com" ,
"link_url": "https://github.com/octocat/hello-world/commit/762941318ee16e59dabbacb1b4049eec22f0d303" ,
2015-07-01 09:23:21 +00:00
"jobs": [
{
2015-10-06 06:18:10 +00:00
"id": 1 ,
2015-07-01 09:23:21 +00:00
"number": 1 ,
"status": "success" ,
2015-10-06 06:18:10 +00:00
"enqueued_at": 1443677151 ,
"started_at": 1443677151 ,
"finished_at": 1443677255 ,
2015-07-01 09:23:21 +00:00
"exit_code": 0 ,
"environment": { "GO_VERSION": "1.4" }
},
{
2015-10-06 06:18:10 +00:00
"id": 2 ,
2015-07-01 09:23:21 +00:00
"number": 2 ,
"status": "success" ,
2015-10-06 06:18:10 +00:00
"enqueued_at": 1443677151 ,
"started_at": 1443677151 ,
"finished_at": 1443677255 ,
2015-07-01 09:23:21 +00:00
"exit_code": 0 ,
"environment": { "GO_VERSION": "1.5" }
}
]
}
2015-05-18 02:25:53 +00:00
properties :
2015-09-08 21:32:05 +00:00
id :
type : integer
format : int64
2015-06-23 07:12:21 +00:00
number :
2015-05-18 02:25:53 +00:00
type : integer
2015-06-23 07:12:21 +00:00
status :
2015-05-18 02:25:53 +00:00
type : string
2015-06-23 07:12:21 +00:00
enum :
- success
- failure
- pending
- started
- error
- killed
2015-10-06 06:18:10 +00:00
created_at :
type : integer
format : int64
enqueued_at :
type : integer
format : int64
started_at :
type : integer
format : int64
finished_at :
type : integer
format : int64
2015-10-27 20:06:13 +00:00
deploy_to :
type : string
2015-10-06 06:18:10 +00:00
commit :
2015-05-18 02:25:53 +00:00
type : string
branch :
type : string
2015-06-23 07:12:21 +00:00
message :
type : string
2015-10-06 06:18:10 +00:00
timestamp :
2015-06-23 07:12:21 +00:00
type : integer
2015-10-06 06:18:10 +00:00
format : int64
ref :
2015-05-18 02:25:53 +00:00
type : string
2015-10-06 06:18:10 +00:00
refspec :
2015-05-18 02:25:53 +00:00
type : string
2015-10-06 06:18:10 +00:00
remote :
type : string
author :
type : string
author_avatar :
type : string
author_email :
2015-05-18 02:25:53 +00:00
type : string
2015-10-06 06:18:10 +00:00
link_url :
type : string
2015-10-23 00:46:18 +00:00
jobs :
type : array
items :
$ref : "#/definitions/Job"
2015-10-06 06:18:10 +00:00
2015-06-23 07:12:21 +00:00
Job :
2015-10-06 06:18:10 +00:00
example : |
{
"id": 1 ,
"number": 1 ,
"status": "success" ,
"enqueued_at": 1443677151 ,
"started_at": 1443677151 ,
"finished_at": 1443677255 ,
"exit_code": 0 ,
"environment": { "GO_VERSION": "1.4" }
}
2015-05-18 02:25:53 +00:00
properties :
2015-09-08 21:32:05 +00:00
id :
type : integer
format : int64
2015-06-23 07:12:21 +00:00
number :
2015-05-18 02:25:53 +00:00
type : integer
2015-06-23 07:12:21 +00:00
status :
2015-05-18 02:25:53 +00:00
type : string
2015-06-23 07:12:21 +00:00
enum :
- success
- failure
- pending
- started
- error
- killed
2015-05-18 02:25:53 +00:00
exit_code :
type : integer
2015-10-06 06:18:10 +00:00
enqueued_at :
2015-05-18 02:25:53 +00:00
type : integer
format : int64
2015-08-19 17:45:01 +00:00
started_at :
type : integer
format : int64
finished_at :
type : integer
format : int64
2015-10-06 06:18:10 +00:00
environment :
type : object
2015-10-23 00:46:18 +00:00
Feed :
example : |
{
"owner": "octocat" ,
"name": "hello-world" ,
"full_name": "octocat/hello-world" ,
"number": 1 ,
"event": "push" ,
"status": "success" ,
"created_at": 1443677151 ,
"enqueued_at": 1443677151 ,
"started_at": 1443677151 ,
"finished_at": 1443677255 ,
"commit": "2deb7e0d0cbac357eeb110c8a2f2f32ce037e0d5" ,
"branch": "master" ,
"ref": "refs/heads/master" ,
"remote": "https://github.com/octocat/hello-world.git" ,
"message": "New line at end of file. --Signed off by Spaceghost" ,
"timestamp": 1443677255 ,
"author": "Spaceghost" ,
"author_avatar": "https://avatars0.githubusercontent.com/u/251370?v=3" ,
"author_email": "octocat@github.com" ,
"link_url": "https://github.com/octocat/hello-world/commit/762941318ee16e59dabbacb1b4049eec22f0d303" ,
}
properties :
owner :
type : string
name :
type : string
full_name :
type : string
number :
type : integer
status :
type : string
enum :
- success
- failure
- pending
- started
- error
- killed
created_at :
type : integer
format : int64
enqueued_at :
type : integer
format : int64
started_at :
type : integer
format : int64
finished_at :
type : integer
format : int64
commit :
type : string
branch :
type : string
message :
type : string
timestamp :
type : integer
format : int64
ref :
type : string
refspec :
type : string
remote :
type : string
author :
type : string
author_avatar :
type : string
author_email :
type : string
link_url :
type : string