Skip to content

Instantly share code, notes, and snippets.

@blide
Last active May 17, 2016 22:22
Show Gist options
  • Select an option

  • Save blide/2cbdbb6cceb36a708ce8873ae2d205e4 to your computer and use it in GitHub Desktop.

Select an option

Save blide/2cbdbb6cceb36a708ce8873ae2d205e4 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: DSP API
description: |
Авторизаационный токен передается в хедере X-Authorization. При при попытке доступа к Authorized endpoint'ам неавторизованным клиентом status code = 401
version: "1.0.0"
# the domain of the service
host: api.dsp.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /v1
produces:
- application/json
consumes:
- application/json
paths:
/user/login:
post:
description: Авторизация
parameters:
- name: login
in: query
description: Пароль
required: true
type: string
- name: password
in: query
description: Логин
required: true
type: string
tags:
- Users
responses:
200:
description: Токен
schema:
$ref: '#/definitions/LoginResp'
default:
description: Ошибка
schema:
$ref: '#/definitions/Error'
/me/logout:
post:
summary: Logout
tags:
- Users
- Authorized
responses:
200:
description: Пустой ответ
/me/campaigns:
get:
summary: Список кампаний пользователя
tags:
- Campaigns
- Authorized
responses:
200:
description: Список кампаний на данной странице
schema:
type: object
properties:
count:
type: integer
description: Общее количество кампаний пользователя
pages:
type: integer
description: Количество страниц
page:
type: integer
description: Текущая страница
campaigns:
type: array
items:
$ref: "#/definitions/Campaign"
/campaigns:
post:
summary: Создание новой кампании
tags:
- Campaigns
- Authorized
consumes:
- application/json
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/CampaignMutable"
responses:
200:
description: ""
schema:
$ref: "#/definitions/ValResp"
/campaigns/{campaignId}:
parameters:
- name: campaignId
in: path
description: ID кампании
required: true
type: string
get:
summary: Получение кампании с ID campaignId
tags:
- Campaigns
- Authorized
responses:
200:
description: ""
schema:
$ref: "#/definitions/Campaign"
404:
description: Кампания с таким ID не найдена
put:
summary: Изменение кампании
tags:
- Campaigns
- Authorized
consumes:
- application/json
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/CampaignMutable"
responses:
200:
description: ""
schema:
$ref: "#/definitions/ValResp"
404:
description: Кампания с таким ID не найдена
delete:
summary: Удаление кампании(creativeId)
tags:
- Campaigns
- Authorized
responses:
200:
description: ""
schema:
$ref: "#/definitions/BoolResp"
404:
description: Кампания с таким ID не найдена
/campaigns/{campaignId}/creatives:
parameters:
- name: campaignId
in: path
description: ID кампании
required: true
type: string
get:
summary: Список креативов кампании(campaignId)
tags:
- Campaigns
- Creatives
- Authorized
responses:
200:
description: ""
schema:
$ref: "#/definitions/Creative"
404:
description: Кампания с таким ID не найдена
post:
summary: Добавление креатива в кампанию(campaignId)
tags:
- Campaigns
- Creatives
- Authorized
consumes:
- application/json
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/CreativeMutable"
responses:
200:
description: ""
schema:
$ref: "#/definitions/ValResp"
404:
description: Кампания с таким ID не найдена
/campaigns/{campaignId}/creatives/{creativeId}:
parameters:
- name: campaignId
in: path
description: ID кампании
required: true
type: string
- name: creativeId
in: path
description: ID креатива
required: true
type: string
get:
summary: Получение креатива(creativeId)
tags:
- Campaigns
- Creatives
- Authorized
responses:
200:
description: ""
schema:
$ref: "#/definitions/Creative"
404:
description: Кампания с таким ID не найдена
put:
summary: Изменения креатива(creativeId)
tags:
- Campaigns
- Creatives
- Authorized
consumes:
- application/json
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/CreativeMutable"
responses:
200:
description: ""
schema:
type: object
properties:
success:
type: boolean
description: true, если изменение креатива прошло успешно, иначе false
val_errors:
type: array
items:
$ref: "#/definitions/ValError"
404:
description: Креатив с таким ID не найден
delete:
summary: Удаление креатива(creativeId)
tags:
- Campaigns
- Creatives
- Authorized
responses:
200:
description: ""
schema:
$ref: "#/definitions/BoolResp"
404:
description: Кампания или креатив с таким ID не найдены
definitions:
Campaign:
allOf:
- $ref: "#/definitions/CampaignMutable"
- required:
- id
- user_id
- audit_status
properties:
id:
type: integer
user_id:
type: integer
audit_status:
type: integer
CampaignMutable:
type: object
required:
- name
- url
- categories
- domain
- start_date
- end_date
- total_budget
- daily_budget
- hourly_budget
- appdaily_budget
- bid_type
- bid_price
- bid_price_min
- roi_limit
- status
- freq_capping
- ssps
properties:
name:
type: string
url:
type: string
categories:
type: array
items:
type: string
domain:
type: string
start_date:
type: integer
end_date:
type: integer
total_budget:
type: number
format: float
daily_budget:
type: number
format: float
hourly_budget:
type: number
format: float
appdaily_budget:
type: number
format: float
bid_type:
type: integer
bid_price:
type: number
format: float
bid_price_min:
type: number
format: float
roi_limit:
type: integer
status:
type: integer
freq_capping:
type: integer
targeting:
$ref: "#/definitions/Targeting"
ssps:
type: array
items:
type: string
Targeting:
type: object
properties:
location:
$ref: "#/definitions/InEx"
categories:
$ref: "#/definitions/InEx"
connection:
type: integer
os:
$ref: "#/definitions/InEx"
device_brand:
$ref: "#/definitions/InEx"
device_type:
type: integer
browser:
$ref: "#/definitions/InEx"
language:
$ref: "#/definitions/InEx"
isp:
$ref: "#/definitions/InEx"
ip_ranges:
type: array
items:
type: array
items:
type: integer
day_parting:
type: array
items:
type: array
items:
type: boolean
InEx:
type: object
properties:
included:
type: array
items:
type: integer
excluded:
type: array
items:
type: integer
Creative:
allOf:
- $ref: "#/definitions/CreativeMutable"
- required:
- id
- campaign_id
- audit_status
properties:
id:
type: integer
campaign_id:
type: integer
audit_status:
type: integer
CreativeMutable:
type: object
required:
- name
- status
properties:
name:
type: string
status:
type: integer
ValError:
type: object
description: |
Если поле field пустое, то данная ошибка относится ко всем данным
properties:
field:
type: string
description: Название поля с ошибкой
code:
type: string
description: Код ошибки(строка), используется как идентификатор
Error:
type: object
properties:
code:
type: integer
fields:
type: string
LoginResp:
type: object
properties:
success:
type: boolean
description: true, если авторизация прошла успешно, иначе false
access_token:
type: string
description: Токен, который будет использоваться для аутентификации пользователя
expires:
type: integer
format: int32
description: timestamp Дата, до которой токен будет действителен
ValResp:
type: object
properties:
success:
type: boolean
description: true, если операция прошла успешно, иначе false
val_errors:
type: array
items:
$ref: "#/definitions/ValError"
BoolResp:
type: object
properties:
success:
type: boolean
description: true, если операция прошла успешно, иначе false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment