Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 12.39 KB | None | 0 0
  1. openapi: 3.0.0
  2. info:
  3.   title: PubNub Signals
  4.   description: API for Signaling
  5.   contact:
  6.     name: API Support
  7.     url: https://pubnub.com/support
  8.     email: support@pubnub.com
  9.   version: 0.0.1
  10. servers:
  11. - url: https://ps.pndsn.com
  12. paths:
  13.   /signal/{pub_key}/{sub_key}/0/{channel}/{callback}/{payload}:
  14.     get:
  15.       tags:
  16.      - Signal (GET)
  17.       summary: Signal a message to a channel
  18.       description: This resource allows a developer to Signal a message to a channel
  19.       operationId: SignalGET
  20.       parameters:
  21.       - name: pub_key
  22.         in: path
  23.         description: 'Your PubNub Publish API Key '
  24.         required: true
  25.         style: simple
  26.         explode: false
  27.         schema:
  28.           type: string
  29.       - name: sub_key
  30.         in: path
  31.         description: 'Your PubNub Subscribe API Key '
  32.         required: true
  33.         style: simple
  34.         explode: false
  35.         schema:
  36.           type: string
  37.       - name: channel
  38.         in: path
  39.         description: The channel name you wish to signal
  40.         required: true
  41.         style: simple
  42.         explode: false
  43.         schema:
  44.           type: string
  45.       - name: callback
  46.         in: path
  47.         description: The JSONP callback
  48.         required: true
  49.         style: simple
  50.         explode: false
  51.         schema:
  52.           type: string
  53.       - name: payload
  54.         in: path
  55.         description: The message body as a JSON blob to Signal
  56.         required: true
  57.         schema:
  58.           type: object
  59.       - name: uuid
  60.         in: query
  61.         description: A unique alphanumeric ID for identifying the client to the PubNub
  62.           Presence System, as well as for PubNub Analytics.
  63.         style: form
  64.         explode: true
  65.         schema:
  66.           type: string
  67.       - name: auth
  68.         in: query
  69.         description: If the channel is protected by PAM, auth must be passed with
  70.           a key which is authorized to publish to the channel.
  71.         style: form
  72.         explode: true
  73.         schema:
  74.           type: string
  75.       - name: meta
  76.         in: query
  77.         description: Optional meta field
  78.         style: form
  79.         explode: true
  80.         schema:
  81.           type: object
  82.       responses:
  83.         200:
  84.           $ref: '#/components/responses/Success'
  85.         400:
  86.           $ref: '#/components/responses/BadRequest'
  87.         403:
  88.           $ref: '#/components/responses/Forbidden'
  89.         404:
  90.           $ref: '#/components/responses/NotFound'
  91.         413:
  92.           $ref: '#/components/responses/TooLargeBody'
  93.         429:
  94.           $ref: '#/components/responses/RateLimited'
  95.   /v2/subscribe/{sub_key}/{channel}/{callback}:
  96.     get:
  97.       tags:
  98.      - Subscribe (GET)
  99.       summary: Subscribe to PubNub
  100.       description: This resource allows a developer to Subscribe to PubNub
  101.       operationId: SubscribeGET
  102.       parameters:
  103.       - name: sub_key
  104.         in: path
  105.         description: 'Your PubNub Subscribe API Key '
  106.         required: true
  107.         style: simple
  108.         explode: false
  109.         schema:
  110.           type: string
  111.       - name: channel
  112.         in: path
  113.         description: The channel name you wish to signal
  114.         required: true
  115.         style: simple
  116.         explode: false
  117.         schema:
  118.           type: string
  119.       - name: callback
  120.         in: path
  121.         description: The JSONP callback
  122.         required: true
  123.         style: simple
  124.         explode: false
  125.         schema:
  126.           type: string
  127.       - name: tt
  128.         in: query
  129.         description: The timetoken used in the subscribe loop
  130.         required: true
  131.         style: form
  132.         explode: true
  133.         schema:
  134.           type: integer
  135.       - name: uuid
  136.         in: query
  137.         description: A unique alphanumeric ID for identifying the client to the PubNub
  138.           Presence System, as well as for PubNub Analytics.
  139.         style: form
  140.         explode: true
  141.         schema:
  142.           type: string
  143.       - name: auth
  144.         in: query
  145.         description: If the channel is protected by PAM, auth must be passed with
  146.           a key which is authorized to publish to the channel.
  147.         style: form
  148.         explode: true
  149.         schema:
  150.           type: string
  151.       - name: meta
  152.         in: query
  153.         description: Optional meta field
  154.         style: form
  155.         explode: true
  156.         schema:
  157.           type: object
  158.       responses:
  159.         200:
  160.           $ref: '#/components/responses/SuccessSubscribe'
  161.         400:
  162.           $ref: '#/components/responses/BadRequest'
  163.         403:
  164.           $ref: '#/components/responses/Forbidden'
  165.         429:
  166.           $ref: '#/components/responses/RateLimited'
  167. components:
  168.   responses:
  169.     SuccessSubscribe:
  170.       description: Success
  171.       content:
  172.         'text/javascript':
  173.           schema:
  174.             $ref: '#/components/schemas/SuccessSubscribeResponse'
  175.           example:
  176.             t:
  177.               t: '15632909833085074'
  178.               r: 1
  179.             m:
  180.               - p:
  181.                   t: '15632909833114637'
  182.                   r: 1
  183.                 k: demo
  184.                 c: test
  185.                 d: ping
  186.                 e: 1
  187.     Success:
  188.       description: Success
  189.       content:
  190.         'text/javascript':
  191.           schema:
  192.             $ref: '#/components/schemas/SuccessResponse'
  193.           example:
  194.            - 1
  195.             - Sent
  196.             - '15614849564528142'
  197.     BadRequest:
  198.       description: There was an error with the request
  199.       content:
  200.         'text/javascript':
  201.           schema:
  202.             oneOf:
  203.               - $ref: '#/components/schemas/BadRequestResponse'
  204.               - $ref: '#/components/schemas/InvalidJSONResponse'
  205.               - $ref: '#/components/schemas/MessageTooLargeResponse'
  206.           example:
  207.             message: Invalid Subscribe Key
  208.             error: true
  209.             service: Access Manager
  210.             status: 400
  211.     Forbidden:
  212.       description: Client is not authorized to perform this operation.
  213.       content:
  214.         'text/javascript':
  215.           schema:
  216.             $ref: '#/components/schemas/ForbiddenResponse'
  217.           example:
  218.             message: Forbidden
  219.             payload:
  220.               channels:
  221.                - channel
  222.             error: true
  223.             service: Access Manager
  224.             status: 403
  225.     NotFound:
  226.       description: Requested object was not found.
  227.       content:
  228.         'text/javascript':
  229.           schema:
  230.             $ref: '#/components/schemas/NotFoundResponse'
  231.           example: []
  232.     TooLargeBody:
  233.       description: The Signal POST body is larger than 32KB
  234.       content:
  235.         'text/javascript':
  236.           schema:
  237.             $ref: '#/components/schemas/TooLargeBodyResponse'
  238.           example:
  239.             status: 413
  240.             service: Balancer
  241.             error: true
  242.             message: Request Entity Too Large
  243.     RateLimited:
  244.       description: The Signal POST body is larger than 32KB
  245.       content:
  246.         'text/javascript':
  247.           schema:
  248.             $ref: '#/components/schemas/RateLimitedResponse'
  249.           example:
  250.             status: 429
  251.             error: true
  252.             message: Too many requests.
  253.   schemas:
  254.     SuccessSubscribeResponse:
  255.       type: object
  256.       properties:
  257.         t:
  258.           type: object
  259.           description: The timetoken and region object
  260.         m:
  261.           type: array
  262.           items:
  263.             type: object
  264.             description: An individual message envelope
  265.             properties:
  266.               a:
  267.                 type: string
  268.                 description: The shard ID
  269.               f:
  270.                 type: integer
  271.                 description: A bitmap representing debugflags
  272.               i:
  273.                 type: string
  274.                 description: Client UUID
  275.               s:
  276.                 type: integer
  277.                 description: Sequence Number
  278.               p:
  279.                 type: object
  280.                 description: The object of publish timetoken and region
  281.                 properties:
  282.                   t:
  283.                     type: integer
  284.                     description: Publish timetoken
  285.                   r:
  286.                     type: string
  287.                     description: The region
  288.               o:
  289.                 type: object
  290.                 description: The object of origin timetoken and region
  291.                 properties:
  292.                   t:
  293.                     type: integer
  294.                     description: Timetoken issued by client originating the message
  295.                   r:
  296.                     type: string
  297.                     description: The region
  298.               c:
  299.                 type: string
  300.                 description: The channel subscribed too
  301.               k:
  302.                 type: string
  303.                 description: The subscribe key
  304.               d:
  305.                 type: object
  306.                 description: The message payload
  307.               e:
  308.                 type: integer
  309.                 description: A bitmap representing the message type. 0 or not present is a normal publish. 1 is a signal.
  310.               u:
  311.                 type: object
  312.                 description: User Metadata
  313.           description: The array of message objects
  314.     SuccessResponse:
  315.       type: object
  316.       properties:
  317.         1:
  318.           type: integer
  319.           description: A constant 1
  320.         Sent:
  321.           type: string
  322.           description: A constant "Sent"
  323.         Timetoken:
  324.           type: number
  325.           description: A 17 digit timetoken defined since the epoch. It represents when the Signal happened.
  326.     BadRequestResponse:
  327.       type: object
  328.       properties:
  329.         message:
  330.           type: string
  331.           description: A description of the error
  332.         error:
  333.           type: boolean
  334.           description: The boolean true as an error occured
  335.         service:
  336.           type: string
  337.           description: The service which rejected the request
  338.         status:
  339.           type: integer
  340.           description: The status code returned in the response header duplicated in the body
  341.     InvalidJSONResponse:
  342.       type: object
  343.       properties:
  344.         0:
  345.           type: integer
  346.           description: A constant 0
  347.         Invalid JSON:
  348.           type: string
  349.           description: A constant "Invalid JSON"
  350.         Timetoken:
  351.           type: number
  352.           description: A 17 digit timetoken defined since the epoch. It represents when the Signal was attempted.
  353.     MessageTooLargeResponse:
  354.       type: object
  355.       properties:
  356.         0:
  357.           type: integer
  358.           description: A constant 0
  359.         Signal size too large:
  360.           type: string
  361.           description: A constant "Signal size too large"
  362.         Timetoken:
  363.           type: number
  364.           description: A 17 digit timetoken defined since the epoch. It represents when the Signal was attempted.
  365.     ForbiddenResponse:
  366.       type: object
  367.       properties:
  368.         message:
  369.           type: string
  370.           description: A description of the error
  371.         payload:
  372.           type: object
  373.           description: The resources that were requested and forbidden
  374.         error:
  375.           type: boolean
  376.           description: The boolean true as an error occured
  377.         service:
  378.           type: string
  379.           description: The service which rejected the request
  380.         status:
  381.           type: integer
  382.           description: The status code returned in the response header duplicated in the body
  383.     NotFoundResponse:
  384.       type: array
  385.       description: An empty array
  386.     TooLargeBodyResponse:
  387.       type: object
  388.       properties:
  389.         message:
  390.           type: string
  391.           description: A description of the error
  392.         error:
  393.           type: boolean
  394.           description: The boolean true as an error occured
  395.         service:
  396.           type: string
  397.           description: The service which rejected the request
  398.         status:
  399.           type: integer
  400.           description: The status code returned in the response header duplicated in the body
  401.     RateLimitedResponse:
  402.       type: object
  403.       properties:
  404.         message:
  405.           type: string
  406.           description: A description of the error
  407.         error:
  408.           type: boolean
  409.           description: The boolean true as an error occured
  410.         status:
  411.           type: integer
  412.           description: The status code returned in the response header duplicated in the body
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement