d11596e446e210ea529dd01ad3176bddda44fb2f.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #%RAML 0.8
  2. title: Booking
  3. baseUri: http://dddsample.marcusoncode.se/booking/{version}
  4. version: v1
  5. /cargos:
  6. get:
  7. description: All booked cargos
  8. responses:
  9. 200:
  10. body:
  11. application/json:
  12. example: |
  13. {
  14. "cargos": [
  15. {
  16. "arrival_deadline": "0001-01-01T00:00:00Z",
  17. "destination": "CNHKG",
  18. "misrouted": false,
  19. "origin": "SESTO",
  20. "routed": false,
  21. "tracking_id": "ABC123"
  22. },
  23. {
  24. "arrival_deadline": "0001-01-01T00:00:00Z",
  25. "destination": "SESTO",
  26. "misrouted": false,
  27. "origin": "AUMEL",
  28. "routed": false,
  29. "tracking_id": "FTL456"
  30. }
  31. ]
  32. }
  33. post:
  34. description: Book a new cargo.
  35. body:
  36. application/json:
  37. example: |
  38. {
  39. "origin": "SESTO",
  40. "destination": "DEHAM",
  41. "arrival_deadline": "2016-03-24T23:00:00Z"
  42. }
  43. responses:
  44. 200:
  45. body:
  46. application/json:
  47. example: |
  48. {
  49. "tracking_id": "ABC123"
  50. }
  51. /{trackingId}:
  52. uriParameters:
  53. trackingId:
  54. description: The tracking id of the cargo
  55. type: string
  56. get:
  57. description: A specific cargo
  58. responses:
  59. 200:
  60. body:
  61. application/json:
  62. example: |
  63. {
  64. "cargo": {
  65. "arrival_deadline": "2016-03-30T22:00:00Z",
  66. "destination": "DEHAM",
  67. "legs": [
  68. {
  69. "voyage_number": "0300A",
  70. "from": "CNHKG",
  71. "to": "SESTO",
  72. "load_time": "2016-03-06T18:12:11.01579612Z",
  73. "unload_time": "2016-03-08T02:13:11.01579612Z"
  74. },
  75. {
  76. "voyage_number": "0400S",
  77. "from": "SESTO",
  78. "to": "FIHEL",
  79. "load_time": "2016-03-10T01:42:11.01579612Z",
  80. "unload_time": "2016-03-11T04:21:11.01579612Z"
  81. },
  82. {
  83. "voyage_number": "0100S",
  84. "from": "FIHEL",
  85. "to": "NLRTM",
  86. "load_time": "2016-03-13T08:42:11.01579612Z",
  87. "unload_time": "2016-03-14T01:38:11.01579612Z"
  88. }
  89. ],
  90. "misrouted": true,
  91. "origin": "CNHKG",
  92. "routed": true,
  93. "tracking_id": "D0909E1C"
  94. }
  95. }
  96. /assign_to_route:
  97. post:
  98. description: Assign given route to the cargo.
  99. body:
  100. application/json:
  101. example: |
  102. {
  103. "legs": [
  104. {
  105. "voyage_number": "0301S",
  106. "from": "SESTO",
  107. "to": "FIHEL",
  108. "load_time": "2015-11-14T14:10:29.173391809Z",
  109. "unload_time": "2015-11-15T21:55:29.173391809Z"
  110. },
  111. {
  112. "voyage_number": "0100S",
  113. "from": "FIHEL",
  114. "to": "CNHKG",
  115. "load_time": "2015-11-18T02:19:29.173391809Z",
  116. "unload_time": "2015-11-19T04:11:29.173391809Z"
  117. }
  118. ]
  119. }
  120. /change_destination:
  121. post:
  122. description: Change destination of the cargo. May result in a misrouted cargo.
  123. body:
  124. application/json:
  125. example: |
  126. {
  127. "destination": "CNHKG"
  128. }
  129. /request_routes:
  130. get:
  131. description: Requests routes based on current specification. Uses an external routing service provided by the routing package.
  132. responses:
  133. 200:
  134. body:
  135. application/json:
  136. example: |
  137. {
  138. "routes": [
  139. {
  140. "legs": [
  141. {
  142. "voyage_number": "0301S",
  143. "from": "SESTO",
  144. "to": "FIHEL",
  145. "load_time": "2015-11-14T14:10:29.173391809Z",
  146. "unload_time": "2015-11-15T21:55:29.173391809Z"
  147. },
  148. {
  149. "voyage_number": "0100S",
  150. "from": "FIHEL",
  151. "to": "CNHKG",
  152. "load_time": "2015-11-18T02:19:29.173391809Z",
  153. "unload_time": "2015-11-19T04:11:29.173391809Z"
  154. }
  155. ]
  156. },
  157. {
  158. "legs": [
  159. {
  160. "voyage_number": "0400S",
  161. "from": "SESTO",
  162. "to": "JNTKO",
  163. "load_time": "2015-11-14T06:22:29.173415471Z",
  164. "unload_time": "2015-11-15T10:22:29.173415471Z"
  165. },
  166. {
  167. "voyage_number": "0200T",
  168. "from": "JNTKO",
  169. "to": "CNHKG",
  170. "load_time": "2015-11-17T10:45:29.173415471Z",
  171. "unload_time": "2015-11-18T11:48:29.173415471Z"
  172. }
  173. ]
  174. }
  175. ]
  176. }
  177. /locations:
  178. get:
  179. description: All registered locations.
  180. responses:
  181. 200:
  182. body:
  183. application/json:
  184. example: |
  185. {
  186. "locations": [
  187. {
  188. "locode": "DEHAM",
  189. "name": "Hamburg"
  190. },
  191. {
  192. "locode": "SESTO",
  193. "name": "Stockholm"
  194. },
  195. {
  196. "locode": "AUMEL",
  197. "name": "Melbourne"
  198. },
  199. {
  200. "locode": "CNHKG",
  201. "name": "Hongkong"
  202. },
  203. {
  204. "locode": "JNTKO",
  205. "name": "Tokyo"
  206. },
  207. {
  208. "locode": "NLRTM",
  209. "name": "Rotterdam"
  210. }
  211. ]
  212. }