Advertisement
Guest User

swagger

a guest
Apr 4th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 8.70 KB | None | 0 0
  1. openapi: 3.0.0
  2. servers:
  3.   - url: 'http://localhost/vbc/rdw'
  4. info:
  5.   version: 1.0.1
  6.   title: RDW API
  7.   description: An API to manipulate the contents and behavior of the RDW
  8. paths:
  9.   /login:
  10.     post:
  11.       summary: Login
  12.       tags:
  13.        - login
  14.       security: []
  15.       description: Authenticating towards VBC to receive the Session cookie
  16.       requestBody:
  17.         content:
  18.           application/json:
  19.             schema:
  20.               required:
  21.                - username
  22.                 - password
  23.               properties:
  24.                 username:
  25.                   type: string
  26.                   example: admin
  27.                 password:
  28.                   type: string
  29.                   example: elvis
  30.         description: Valid VBC account credentials
  31.         required: true
  32.       responses:
  33.         '204':
  34.           headers:
  35.             Set-Cookie:
  36.               description: Session
  37.               schema:
  38.                 type: string
  39.           description: >
  40.            Successfully authenticated. The session ID is returned in a cookie
  41.             named `Session`. You need to include this cookie in subsequent
  42.             requests. The session is valid for 5 minutes, after this, you need
  43.             to log in again.
  44.         '400':
  45.           description: Invalid parameters
  46.         '401':
  47.           description: Incorrect username and/or password
  48.         '503':
  49.           description: Unable to log in
  50.   /devices:
  51.     get:
  52.       summary: Get list of devices
  53.       tags:
  54.        - devices
  55.       description: Returns a list of all devices accessable by the authenticated user
  56.       responses:
  57.         '200':
  58.           description: A list of Device
  59.           content:
  60.             application/json:
  61.               schema:
  62.                 $ref: '#/components/schemas/Devices'
  63.   '/devices/{uuid}':
  64.     patch:
  65.       summary: Update device
  66.       tags:
  67.        - devices
  68.       description: Change what canvas is displayed on a device
  69.       parameters:
  70.         - $ref: '#/components/parameters/uuid'
  71.       requestBody:
  72.         content:
  73.           application/json:
  74.             schema:
  75.               $ref: '#/components/schemas/Device'
  76.         description: Device properties to update
  77.       responses:
  78.         '204':
  79.           description: Update completed
  80.         '400':
  81.           description: Invalid parameters
  82.         '403':
  83.           description: Authenticated user does not have access to this device
  84.         '404':
  85.           description: Canvas does not exist
  86.         '503':
  87.           description: 'Could not update database, try again later'
  88.   /canvas:
  89.     get:
  90.       summary: Get list of canvases
  91.       tags:
  92.        - canvas
  93.       description: Returns a list of all canvases accessable by the authenticated user
  94.       responses:
  95.         '200':
  96.           description: A list of Canvas
  97.           content:
  98.             application/json:
  99.               schema:
  100.                 $ref: '#/components/schemas/Canvases'
  101.   '/canvas/{canvasId}/widgets':
  102.     get:
  103.       summary: Get map of widgets
  104.       tags:
  105.        - canvas
  106.       description: Returns a map of all widgets on specified canvas
  107.       parameters:
  108.         - $ref: '#/components/parameters/canvasId'
  109.       responses:
  110.         '200':
  111.           description: A map of widgetId to Widget
  112.           content:
  113.             application/json:
  114.               schema:
  115.                 $ref: '#/components/schemas/Widgets'
  116.         '403':
  117.           description: Authenticated user does not have access to this canvas
  118.         '404':
  119.           description: Canvas does not exist
  120.   '/canvas/{canvasId}/{widgetId}':
  121.     patch:
  122.       summary: Update widget
  123.       tags:
  124.        - canvas
  125.       description: Change widget configuration
  126.       parameters:
  127.         - $ref: '#/components/parameters/canvasId'
  128.         - $ref: '#/components/parameters/widgetId'
  129.       requestBody:
  130.         content:
  131.           application/json:
  132.             schema:
  133.               $ref: '#/components/schemas/WidgetPatchExample'
  134.         description: Parameters that will be updated
  135.       responses:
  136.         '200':
  137.           description: Update completed
  138.           content:
  139.             application/json:
  140.               schema:
  141.                 $ref: '#/components/schemas/Widget'
  142.         '400':
  143.           description: Invalid parameters
  144.         '403':
  145.           description: Authenticated user does not have access to this canvas
  146.         '404':
  147.           description: Canvas or widget does not exist
  148.         '409':
  149.           description: Serial mismatch
  150.         '503':
  151.           description: 'Could not update database, try again later'
  152. security:
  153.   - sessionAuth: []
  154. components:
  155.   securitySchemes:
  156.     sessionAuth:
  157.       type: apiKey
  158.       in: cookie
  159.       name: Session
  160.   parameters:
  161.     session:
  162.       name: Session
  163.       in: cookie
  164.       required: true
  165.       description: The session cookie
  166.       schema:
  167.         type: string
  168.     uuid:
  169.       name: uuid
  170.       in: path
  171.       required: true
  172.       description: The device's UUID
  173.       schema:
  174.         type: string
  175.     canvasId:
  176.       name: canvasId
  177.       in: path
  178.       required: true
  179.       description: The canvas' ID
  180.       schema:
  181.         type: integer
  182.     widgetId:
  183.       name: widgetId
  184.       in: path
  185.       required: true
  186.       description: The widget's ID
  187.       schema:
  188.         type: integer
  189.   schemas:
  190.     Device:
  191.       type: object
  192.       properties:
  193.         uuid:
  194.           type: string
  195.           readOnly: true
  196.           example: 95494c38-72db-43b7-a523-d798616dc8d1
  197.         alias:
  198.           type: string
  199.           example: Device 1
  200.         canvasId:
  201.           type: integer
  202.           example: 1
  203.     Devices:
  204.       type: array
  205.       items:
  206.         $ref: '#/components/schemas/Device'
  207.     Canvas:
  208.       type: object
  209.       properties:
  210.         id:
  211.           type: integer
  212.           example: 1
  213.         name:
  214.           type: string
  215.           example: NOC
  216.         owner:
  217.           type: string
  218.           example: admin
  219.         carousel:
  220.           type: array
  221.           items:
  222.             type: integer
  223.           example: []
  224.     Canvases:
  225.       type: array
  226.       items:
  227.         $ref: '#/components/schemas/Canvas'
  228.     WidgetPatchExample:
  229.       type: object
  230.       properties:
  231.         conf:
  232.           type: object
  233.           properties:
  234.             bladeId:
  235.               type: string
  236.               example: 8
  237.             bladeAddr:
  238.               type: string
  239.               example: 10.0.30.188
  240.             bladeName:
  241.               type: string
  242.               example: Extractor
  243.             iface:
  244.               type: string
  245.               example: OTT
  246.             streamName:
  247.               type: string
  248.               example: Stream02
  249.             sid:
  250.               type: integer
  251.               example: 0
  252.             pid:
  253.               type: integer
  254.               example: -1
  255.             serviceName:
  256.               type: string
  257.               example: Unknown
  258.             url:
  259.               type: string
  260.               example: /extractor/static/images/thums/ott_2_0.jpg
  261.     Widget:
  262.       type: object
  263.       properties:
  264.         id:
  265.           type: integer
  266.           readOnly: true
  267.           example: 1
  268.         name:
  269.           type: string
  270.           example: thumb
  271.         conf:
  272.           type: object
  273.           properties:
  274.             width:
  275.               type: integer
  276.               example: 450
  277.             height:
  278.               type: integer
  279.               example: 255
  280.             top:
  281.               type: integer
  282.               example: 0
  283.             left:
  284.               type: integer
  285.               example: 0
  286.             bladeId:
  287.               type: string
  288.               example: 8
  289.             bladeAddr:
  290.               type: string
  291.               example: 10.0.30.188
  292.             bladeName:
  293.               type: string
  294.               example: Extractor
  295.             iface:
  296.               type: string
  297.               example: OTT
  298.             streamName:
  299.               type: string
  300.               example: Stream01
  301.             sid:
  302.               type: integer
  303.               example: 0
  304.             pid:
  305.               type: integer
  306.               example: -1
  307.             serviceName:
  308.               type: string
  309.               example: Unknown
  310.             plaqueDisplay:
  311.               type: string
  312.               example: Top
  313.             plaqueText:
  314.               type: string
  315.               example: Stream01 via Extractor (OTT)
  316.             url:
  317.               type: string
  318.               example: /extractor/static/images/thums/ott_9_0.jpg
  319.           additionalProperties: true
  320.         serial:
  321.           type: integer
  322.           example: 2
  323.     Widgets:
  324.       type: object
  325.       additionalProperties:
  326.         $ref: '#/components/schemas/Widget'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement