4445.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. openapi: 3.0.0
  2. info:
  3. title: Callback Example
  4. version: 1.0.0
  5. paths:
  6. /streams:
  7. post:
  8. description: subscribes a client to receive out-of-band data
  9. parameters:
  10. - name: callbackUrl
  11. in: query
  12. required: true
  13. description: |
  14. the location where data will be sent. Must be network accessible
  15. by the source server
  16. schema:
  17. type: string
  18. format: uri
  19. example: https://tonys-server.com
  20. responses:
  21. '201':
  22. description: subscription successfully created
  23. content:
  24. application/json:
  25. schema:
  26. description: subscription information
  27. required:
  28. - subscriptionId
  29. properties:
  30. subscriptionId:
  31. description: this unique identifier allows management of the subscription
  32. type: string
  33. example: 2531329f-fb09-4ef7-887e-84e648214436
  34. callbacks:
  35. # the name `onData` is a convenience locator
  36. onData:
  37. $ref: '#/components/callbacks/onData'
  38. components:
  39. callbacks:
  40. onData:
  41. # when data is sent, it will be sent to the `callbackUrl` provided
  42. # when making the subscription PLUS the suffix `/data`
  43. '{$request.query.callbackUrl}/data':
  44. post:
  45. requestBody:
  46. description: subscription payload
  47. content:
  48. application/json:
  49. schema:
  50. properties:
  51. timestamp:
  52. type: string
  53. format: date-time
  54. userData:
  55. type: string
  56. responses:
  57. '202':
  58. description: |
  59. Your server implementation should return this HTTP status code
  60. if the data was received successfully
  61. '204':
  62. description: |
  63. Your server should return this HTTP status code if no longer interested
  64. in further updates