Skip to content

Instantly share code, notes, and snippets.

@cyrilis
Last active June 5, 2017 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyrilis/5f7930355b2d73342539914be0d09975 to your computer and use it in GitHub Desktop.
Save cyrilis/5f7930355b2d73342539914be0d09975 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: COE API
description: COE Project API, make repentance great again.
version: 1.0.0
host: api.coe.devops.dataengine.com
schemes:
- http
basePath: '/'
produces:
- application/json
paths:
/coe:
get:
summary: get COE list
description: |
get filted COE list with params.
parameters:
- name: department
in: query
description: the department of COE.
required: false
type: string
format: string
- name: limit
in: query
description: Max COE count in a query.
required: false
type: number
format: double
- name: page
in: query
description: pagination page.
required: false
type: number
format: double
- name: id
in: query
description: The ID of COE
required: false
type: string
format: string
tags:
- COE
responses:
'200':
description: An array of COEs
schema:
type: array
items:
$ref: '#/definitions/COE'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: 'Create a COE'
description: 'A Coe Can be created from ticket or from blank.'
tags:
- COE
parameters:
- name: 'COE'
in: body
description: "the title of the COE"
schema:
type: object
required:
- title
properties:
title:
type: string
owner:
type: string
department:
type: string
incident_date:
type: string
publish_date:
type: string
content:
type: string
attachments:
type: array
items:
type: string
description: 'ID of attachments.'
related_items:
type: array
items:
type: string
description: 'ID of related_items'
responses:
'200':
description: 'Created successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/COE'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
put:
summary: 'Update COE'
description: 'Updated COE attributes, actions , attachments, ...'
tags:
- COE
parameters:
- name: 'COE'
in: body
description: "the title of the COE"
schema:
type: object
required:
- title
properties:
title:
type: string
owner:
type: string
department:
type: string
incident_date:
type: string
publish_date:
type: string
content:
type: string
attachments:
type: array
items:
type: string
description: 'ID of attachments.'
related_items:
type: array
items:
type: string
description: 'ID of related_items'
actions:
type: array
items:
type: string
description: 'ID of actions'
responses:
'200':
description: 'Updated successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/COE'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
delete:
summary: 'Delete a COE'
description: 'Delete a COE by ID'
tags:
- COE
parameters:
- name: id
in: query
description: 'the Unique ID of COE'
required: true
type: string
format: string
responses:
'200':
description: 'Deleted successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
message:
type: string
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
/attachment:
get:
summary: 'Get attachment'
description: 'Get attachment by ID'
tags:
- Attachment
parameters:
- name: 'id'
in: query
type: string
required: true
description: get attachment by id
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Attachment'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
post:
summary: 'Created Attachment'
description: 'Upload File'
tags:
- Attachment
consumes:
- 'multipart/form-data'
parameters:
- name: file
in: formData
type: file
required: true
description: 'File to upload.'
- name: description
in: formData
type: string
required: false
description: 'Description for attachment'
responses:
200:
description: OK
default:
description: 'Unexpected Error'
put:
summary: 'Update Attachment'
description: 'Updated Attachment property'
tags:
- Attachment
parameters:
- name: attachment
in: body
description: ''
schema:
type: object
properties:
id:
type: string
description:
type: string
responses:
'200':
description: 'Updated successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/Attachment'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
/related_items:
get:
summary: 'Get related items'
description: 'Get related items by ID'
tags:
- Related Items
parameters:
- name: 'id'
in: query
type: string
required: true
description: get related items by id
responses:
'200':
description: OK
schema:
$ref: '#/definitions/RelatedItems'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
post:
summary: 'Created Related Items'
description: 'Upload File'
tags:
- Related Items
parameters:
- name: related_items
in: body
description: ''
schema:
type: object
properties:
type:
type: string
value:
type: string
description: 'URL or ID'
responses:
200:
description: 'Created successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/RelatedItems'
default:
description: 'Unexpected Error'
put:
summary: 'Update Related Items'
description: 'Update Related Items Property'
tags:
- Related Items
parameters:
- name: related_items
in: body
description: ''
schema:
type: object
properties:
id:
type: string
title:
type: string
responses:
'200':
description: 'Updated successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/RelatedItems'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
/actions:
get:
summary: 'Get Action'
description: 'Get related items by ID'
tags:
- Actions
parameters:
- name: 'id'
in: query
type: string
required: true
description: GET Action by ID
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Action'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
post:
summary: 'Created ACTION'
description: 'Create Action'
tags:
- Actions
parameters:
- name: action
in: body
description: ''
schema:
type: object
properties:
owner:
type: string
title:
type: string
completed:
type: boolean
responses:
200:
description: OK
default:
description: 'Unexpected Error'
put:
summary: 'Update Action'
description: 'Update action Property'
tags:
- Actions
parameters:
- name: action
in: body
description: ''
schema:
type: object
properties:
owner:
type: string
title:
type: string
completed:
type: boolean
responses:
'200':
description: 'Updated successfuly'
schema:
type: object
properties:
code:
type: number
description: 'Code'
default: 200
data:
$ref: '#/definitions/Action'
default:
description: Unexpected Error
schema:
$ref: '#/definitions/Error'
definitions:
COE:
type: object
properties:
id:
type: string
description: 'Unique ID of COE.'
title:
type: string
description: 'The Title of the COE.'
department:
type: string
description: 'The id of the department which the COE belongs to.'
owner:
type: string
description: 'Owner(User) id.'
publish_date:
type: number
description: 'Display name of product.'
publish_date_change_times:
type: number
description: 'RT'
status:
type: string
description: "The status of the COE, could be ['draft', 'open', 'preview', 'published', 'closed']"
incident_date:
type: number
description: 'The date when the incident happens.'
actions:
type: array
description: 'The array list of the actions attached to this COE.'
items:
$ref: '#/definitions/Action'
attachments:
type: array
description: 'The attachment list of the COE.'
items:
$ref: '#/definitions/Attachment'
version:
type: array
items:
type: object
properties:
user:
type: string
description: 'user id'
date:
type: number
description: 'Change date.'
content:
type: string
description: 'Content'
follower:
type: array
items:
type: object
properties:
type:
type: string
description: 'Follower Type, [email, user].'
items:
type: array
items:
type: string
description: 'Follower item.'
related_items:
type: array
items:
$ref: '#/definitions/RelatedItems'
content:
type: string
description: 'The content of the COE. When content changed, save snapshot into versions.'
Action:
type: object
properties:
title:
type: string
description: 'The title.'
owner:
type: string
description: 'The owner id of action.'
id:
type: string
description: 'Unique id.'
completed:
type: boolean
description: 'Weather this action is completed.'
Attachment:
type: object
properties:
id:
type: string
description: 'Unique ID'
file:
type: string
description: 'File URL'
name:
type: string
description: 'File name.'
description:
type: string
description: "File description"
RelatedItems:
type: object
properties:
id:
type: string
description: 'The unique ID of the item'
type:
type: string
description: 'The type of the item.'
url:
type: string
description: 'The URL of the item.'
title:
type: string
description: 'The title of the item.'
Department:
type: object
properties:
id:
type: string
description: 'Unique ID'
leader:
type: string
description: 'Leader Email'
name:
type: string
description: 'The name of this department'
overview:
type: string
description: 'Extra information.'
users:
type: array
description: 'User List.'
items:
$ref: '#/definitions/User'
User:
type: object
properties:
id:
type: string
description: 'Unique ID'
add_time:
type: number
description: 'User created date.'
avatar:
type: string
description: 'User avatar key.'
company:
type: string
description: 'User company ID'
department:
type: string
description: 'User department ID'
email:
type: string
description: 'User Email'
firstname:
type: string
description: 'User First name'
is_super:
type: boolean
description: 'User is super user.'
lastname:
type: string
description: 'User Last name'
status:
type: string
description: 'User status, [enabled, disabled, removed]'
superior:
type: string
description: 'Supervior Leader.'
telephone:
type: string
description: 'User mobile phone number.'
title:
type: string
description: 'User title.'
update_time:
type: number
description: 'User update time.'
username:
type: string
description: 'user name'
wechat:
type: string
description: 'User Wechat Number.'
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment