Skip to content

Instantly share code, notes, and snippets.

@foxweb
Last active May 11, 2018 17:18
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 foxweb/73d14217edd4280cdd1c3ce4ea3ef325 to your computer and use it in GitHub Desktop.
Save foxweb/73d14217edd4280cdd1c3ce4ea3ef325 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
version: '1.0'
title: Nightingale API
description: Перед вами документация по Nightingale API (система управления контентом). Пока API без версионирования. Звёздочками отмечены обязательные поля. В двойных фигурных {{скобках}} указаны переменные, заданные в environment.
host: example.com
basePath: /
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/authenticate:
post:
description: >-
Аутентификация по емейлу и паролю. Необходимо убедиться, что данный пользователь есть в dev-базе.
В случае успеха в ответе будет заголовок `X-Access-Token`, в значении которого содержится токен. В последующих запросах необходимо использовать полученный токен.
summary: /authenticate
tags:
- 'Аутентификация '
operationId: AuthenticatePost
produces:
- application/json
consumes:
- application/x-www-form-urlencoded
parameters:
- name: email
in: formData
required: true
type: string
description: E-mail*
- name: password
in: formData
required: true
type: string
description: Пароль*
responses:
200:
description: ''
schema:
type: object
examples: {}
security: []
x-unitTests:
- request:
method: POST
uri: /authenticate
headers:
Content-Type: application/x-www-form-urlencoded
body: email={{email}}&password={{password}}
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: NONE
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Connection: Keep-Alive
Content-Length: 0
Content-Security-Policy: "form-action 'self'; frame-ancestors 'self'; base-uri 'self'; default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' https: data:; style-src 'self' 'unsafe-inline' https:; font-src 'self'; object-src 'none'; plugin-types application/pdf; child-src 'self'; frame-src 'self'; media-src 'self'"
Content-Type: application/json; charset=utf-8
Date: Fri, 11 May 2018 11:19:58 GMT
Server: WEBrick/1.4.2 (Ruby/2.5.1/2018-03-29)
Vary: Origin
X-Access-Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNiwiZXhwIjoxNTI2MTIzOTk4fQ.VGxP0J61IQrIyIppQRfxDa8rygBelv6Qz-OIW-P54uI
x-testShouldPass: true
x-testEnabled: true
x-testName: /authenticate
x-testDescription: >-
Аутентификация по емейлу и паролю. Необходимо убедиться, что данный пользователь есть в dev-базе.
В случае успеха в ответе будет заголовок `X-Access-Token`, в значении которого содержится токен. В последующих запросах необходимо использовать полученный токен.
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/users:
get:
description: Возвращает список всех пользователей без ограничений по количеству.
summary: /users
tags:
- Пользователи
operationId: UsersGet
produces:
- application/json
parameters:
- name: X-Access-Token
in: header
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
type: array
items:
$ref: '#/definitions/~1user'
examples: {}
security: []
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
post:
description: Создание пользователя.
summary: /users
tags:
- Пользователи
operationId: UsersPost
produces:
- application/json
consumes:
- application/x-www-form-urlencoded
parameters:
- name: email
in: formData
required: true
type: string
description: E-mail*
- name: password
in: formData
required: true
type: string
description: Пароль*
- name: role
in: formData
required: true
type: string
description: Роль*
- name: first_name
in: formData
required: true
type: string
description: Имя
- name: last_name
in: formData
required: true
type: string
description: Фамилия
- name: phone
in: formData
required: true
type: string
description: Телефон
- name: telegram
in: formData
required: true
type: string
description: Telegram
- name: twitter
in: formData
required: true
type: string
description: Twitter
- name: facebook
in: formData
required: true
type: string
description: Facebook
- name: X-Access-Token
in: header
required: true
type: string
description: ''
responses:
201:
description: ''
schema:
type: object
examples: {}
security: []
x-unitTests:
- request:
method: POST
uri: /users
headers:
Content-Type: application/x-www-form-urlencoded
X-Access-Token: '{{access_token}}'
body: email={{$guid}}@example.com&password=secret&role=editor&first_name=Йован&last_name=Савович&phone=+1 800 555-32-32&telegram=jovan&twitter=jovan&facebook=jovan
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: NONE
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Connection: Keep-Alive
Content-Length: 0
Content-Security-Policy: "form-action 'self'; frame-ancestors 'self'; base-uri 'self'; default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' https: data:; style-src 'self' 'unsafe-inline' https:; font-src 'self'; object-src 'none'; plugin-types application/pdf; child-src 'self'; frame-src 'self'; media-src 'self'"
Content-Type: application/json; charset=utf-8
Date: Fri, 11 May 2018 11:20:53 GMT
Server: WEBrick/1.4.2 (Ruby/2.5.1/2018-03-29)
Vary: Origin
x-testShouldPass: true
x-testEnabled: true
x-testName: /users
x-testDescription: Создание пользователя.
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/users/{last_user_id}:
get:
description: Возвращает пользователя с указанным `id`.
summary: /users/:id
tags:
- Пользователи
operationId: UsersByLastUserIdGet
produces:
- application/json
parameters:
- name: X-Access-Token
in: header
required: true
type: string
description: ''
- name: last_user_id
in: path
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
$ref: '#/definitions/~1users~1:id'
examples:
application/json:
id: 3
first_name: Йован
last_name: Савович
phone: 18005553232
email: user6@example.com
role: editor
telegram: 'jovan'
twitter: 'jovan'
facebook: 'jovan'
security: []
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
patch:
description: Изменение пользователя.
summary: /users/:id
tags:
- Пользователи
operationId: UsersByLastUserIdPatch
produces:
- application/json
consumes:
- application/x-www-form-urlencoded
parameters:
- name: password
in: formData
required: true
type: string
description: Пароль*
- name: role
in: formData
required: true
type: string
description: Роль*
- name: first_name
in: formData
required: true
type: string
description: Имя
- name: last_name
in: formData
required: true
type: string
description: Фамилия
- name: phone
in: formData
required: true
type: string
description: Телефон
- name: telegram
in: formData
required: true
type: string
description: Telegram
- name: twitter
in: formData
required: true
type: string
description: Twitter
- name: facebook
in: formData
required: true
type: string
description: Facebook
- name: X-Access-Token
in: header
required: true
type: string
description: ''
- name: last_user_id
in: path
required: true
type: string
description: ''
responses:
204:
description: ''
schema:
type: object
examples: {}
security: []
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/profile:
get:
description: Возвращает профиль авторизованного пользователя (самого себя).
summary: /profile
tags:
- Профиль пользователя
operationId: ProfileGet
produces:
- application/json
parameters:
- name: X-Access-Token
in: header
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
$ref: '#/definitions/~1profile'
examples:
application/json:
id: 16
first_name: John
last_name: Smith
phone: 18005553344
email: admin@example.com
role: admin
telegram: 'foxwwweb'
twitter: 'foxwwweb'
facebook: 'foxwwweb'
security: []
x-unitTests:
- request:
method: GET
uri: /profile
headers:
X-Access-Token: '{{access_token}}'
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: RAW
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Connection: Keep-Alive
Content-Length: 180
Content-Security-Policy: "form-action 'self'; frame-ancestors 'self'; base-uri 'self'; default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' https: data:; style-src 'self' 'unsafe-inline' https:; font-src 'self'; object-src 'none'; plugin-types application/pdf; child-src 'self'; frame-src 'self'; media-src 'self'"
Content-Type: application/json; charset=utf-8
Date: Fri, 11 May 2018 11:21:13 GMT
Server: WEBrick/1.4.2 (Ruby/2.5.1/2018-03-29)
Vary: Origin
body: '{"id":16,"first_name":"John","last_name":"Smith","phone":18005553344,"email":"admin@example.com","role":"admin","telegram":"foxwwweb","twitter":"foxwwweb","facebook":"foxwwweb"}'
x-testShouldPass: true
x-testEnabled: true
x-testName: /profile
x-testDescription: Возвращает профиль авторизованного пользователя (самого себя).
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
patch:
description: Изменение профиля авторизованного пользователя (самого себя). Все поля необязательные и не могут быть пустыми.
summary: /profile
tags:
- Профиль пользователя
operationId: ProfilePatch
produces:
- application/json
consumes:
- application/x-www-form-urlencoded
parameters:
- name: phone
in: formData
required: true
type: string
description: Телефон
- name: X-Access-Token
in: header
required: true
type: string
description: ''
responses:
204:
description: ''
schema:
type: object
examples: {}
security: []
x-unitTests:
- request:
method: PATCH
uri: /profile
headers:
Content-Type: application/x-www-form-urlencoded
X-Access-Token: '{{access_token}}'
body: phone=+1 800 555-33-44
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: NONE
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Connection: Keep-Alive
Date: Fri, 11 May 2018 11:21:26 GMT
Server: WEBrick/1.4.2 (Ruby/2.5.1/2018-03-29)
Vary: Origin
x-testShouldPass: true
x-testEnabled: true
x-testName: /profile1
x-testDescription: Изменение профиля авторизованного пользователя (самого себя). Все поля необязательные и не могут быть пустыми.
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/documents:
get:
description: Получение всех документов без ограничения по количеству.
summary: /documents
tags:
- Документы
operationId: DocumentsGet
produces:
- application/json
parameters:
- name: X-Access-Token
in: header
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
type: array
items:
$ref: '#/definitions/~1document'
examples:
application/json:
- id: 1
title: A new document
security: []
x-unitTests:
- request:
method: GET
uri: /documents
headers:
X-Access-Token: '{{access_token}}'
expectedResponse:
x-allowExtraHeaders: true
x-bodyMatchMode: RAW
x-arrayOrderedMatching: false
x-arrayCheckCount: false
x-matchResponseSchema: true
headers:
Connection: Keep-Alive
Content-Length: 35
Content-Security-Policy: "form-action 'self'; frame-ancestors 'self'; base-uri 'self'; default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' https: data:; style-src 'self' 'unsafe-inline' https:; font-src 'self'; object-src 'none'; plugin-types application/pdf; child-src 'self'; frame-src 'self'; media-src 'self'"
Content-Type: application/json; charset=utf-8
Date: Fri, 11 May 2018 11:30:05 GMT
Server: WEBrick/1.4.2 (Ruby/2.5.1/2018-03-29)
Vary: Origin
body: '[{"id":1,"title":"A new document"}]'
x-testShouldPass: true
x-testEnabled: true
x-testName: /documents
x-testDescription: Получение всех документов без ограничения по количеству.
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
/documents/{last_document_id}:
get:
description: Возвращает один документ с указанным `id`.
summary: /documents/:id
tags:
- Документы
operationId: DocumentsByLastDocumentIdGet
produces:
- application/json
parameters:
- name: X-Access-Token
in: header
required: true
type: string
description: ''
- name: last_document_id
in: path
required: true
type: string
description: ''
responses:
200:
description: ''
schema:
$ref: '#/definitions/~1documents~1:id'
examples:
application/json:
id: 2
title: Yet another document
deadline: 2018-05-11 11:43:21 UTC
authors: []
boxes: []
security: []
x-unitTests: []
x-operation-settings:
CollectParameters: false
AllowDynamicQueryParameters: false
AllowDynamicFormParameters: false
IsMultiContentStreaming: false
definitions:
/user:
title: /user
type: object
properties:
id:
description: ''
example: 3
type: integer
format: int32
first_name:
description: ''
example: Йован
type: string
last_name:
description: ''
example: Савович
type: string
phone:
description: ''
example: 18005553232
type: integer
format: int64
email:
description: ''
example: user6@example.com
type: string
role:
description: ''
example: editor
type: string
required:
- id
- first_name
- last_name
- phone
- email
- role
/users/:id:
title: /users/:id
example:
id: 3
first_name: Йован
last_name: Савович
phone: 18005553232
email: user6@example.com
role: editor
telegram: 'jovan'
twitter: 'jovan'
facebook: 'jovan'
type: object
properties:
id:
description: ''
example: 3
type: integer
format: int32
first_name:
description: ''
example: Йован
type: string
last_name:
description: ''
example: Савович
type: string
phone:
description: ''
example: 18005553232
type: integer
format: int64
email:
description: ''
example: user6@example.com
type: string
role:
description: ''
example: editor
type: string
telegram:
description: ''
example: 'jovan'
type: string
twitter:
description: ''
example: 'jovan'
type: string
facebook:
description: ''
example: 'jovan'
type: string
required:
- id
- first_name
- last_name
- phone
- email
- role
- telegram
- twitter
- facebook
/profile:
title: /profile
example:
id: 16
first_name: John
last_name: Smith
phone: 18005553344
email: admin@example.com
role: admin
telegram: 'foxwwweb'
twitter: 'foxwwweb'
facebook: 'foxwwweb'
type: object
properties:
id:
description: ''
example: 16
type: integer
format: int32
first_name:
description: ''
example: John
type: string
last_name:
description: ''
example: Smith
type: string
phone:
description: ''
example: 18005553344
type: integer
format: int64
email:
description: ''
example: admin@example.com
type: string
role:
description: ''
example: admin
type: string
telegram:
description: ''
example: 'foxwwweb'
type: string
twitter:
description: ''
example: 'foxwwweb'
type: string
facebook:
description: ''
example: 'foxwwweb'
type: string
required:
- id
- first_name
- last_name
- phone
- email
- role
- telegram
- twitter
- facebook
/document:
title: /document
example:
id: 1
title: A new document
type: object
properties:
id:
description: ''
example: 1
type: integer
format: int32
title:
description: ''
example: A new document
type: string
required:
- id
- title
/documents/:id:
title: /documents/:id
example:
id: 2
title: Yet another document
deadline: 2018-05-11 11:43:21 UTC
authors: []
boxes: []
type: object
properties:
id:
description: ''
example: 2
type: integer
format: int32
title:
description: ''
example: Yet another document
type: string
deadline:
description: ''
example: 2018-05-11 11:43:21 UTC
type: string
authors:
description: ''
example: []
type: array
items:
type: string
boxes:
description: ''
example: []
type: array
items:
type: string
required:
- id
- title
- deadline
- authors
- boxes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment