Talk given at Datapalooza Denver 2016 titled "(Your) Data as a Service: The Easy Way to Build an API for Your Data".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

108 lines
2.5 KiB

  1. swagger: '2.0'
  2. info:
  3. title: Data API Example
  4. version: "0.1"
  5. consumes:
  6. - application/json
  7. produces:
  8. - application/json
  9. #security:
  10. # # enable OAuth protection for all REST endpoints
  11. # # (only active if the TOKENINFO_URL environment variable is set)
  12. # - oauth2: [uid]
  13. paths:
  14. /:
  15. get:
  16. operationId: api_server.root
  17. summary: Get root server response
  18. responses:
  19. 200:
  20. description: Return server information
  21. schema:
  22. type: array
  23. items:
  24. $ref: '#/definitions/Root'
  25. /summary/costs:
  26. get:
  27. operationId: api_server.get_summary_uris
  28. summary: Get links for cost summary data
  29. responses:
  30. 200:
  31. description: Return summary links information
  32. schema:
  33. type: array
  34. items:
  35. $ref: '#/definitions/SummaryURI'
  36. /summary/costs/{year}:
  37. get:
  38. operationId: api_server.get_summary
  39. summary: Get cost data for year
  40. parameters:
  41. - $ref: '#/parameters/year'
  42. responses:
  43. 200:
  44. description: Return cost information
  45. schema:
  46. $ref: '#/definitions/Costs'
  47. ## ALL PARAMETERS HERE
  48. parameters:
  49. year:
  50. name: year
  51. description: Year of data
  52. in: path
  53. type: integer
  54. required: true
  55. pattern: "^[0-9]{4}$"
  56. # ALL DEFINITIONS HERE
  57. definitions:
  58. Root:
  59. type: object
  60. required:
  61. - server_name
  62. properties:
  63. server_name:
  64. type: string
  65. description: Server name identifier
  66. example: "data-one"
  67. readOnly: true
  68. time:
  69. type: string
  70. format: date-time
  71. description: Creation time
  72. example: "2015-07-07T15:49:51.230+02:00"
  73. readOnly: true
  74. SummaryURI:
  75. type: object
  76. properties:
  77. year:
  78. type: integer
  79. description: Year of the data payload
  80. example: "2010"
  81. readOnly: true
  82. link:
  83. type: string
  84. description: The resource link to the containing data
  85. example: "/summary/costs/2010"
  86. readOnly: true
  87. Costs:
  88. type: object
  89. properties:
  90. tuition_and_fees:
  91. type: integer
  92. description: Average annual tuition and fees costs
  93. example: "10000"
  94. readOnly: true
  95. # room_and_board:
  96. # type: integer
  97. # description: Average annual room and board costs
  98. # example: "2000"
  99. # readOnly: true
  100. books_and_supplies:
  101. type: integer
  102. description: Average annual books and fees costs
  103. example: "2000"
  104. readOnly: true