vincentlowe

American Flights Interface.xml

Jan 15th, 2019
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mule xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  3. http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  4. http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd
  5. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
  6. <http:listener-config name="american-flights-api-httpListenerConfig" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
  7. <apikit:config name="american-flights-api-config" raml="american-flights-api.raml" consoleEnabled="false" doc:name="Router"/>
  8. <flow name="american-flights-api-main">
  9. <http:listener config-ref="american-flights-api-httpListenerConfig" path="/api/*" doc:name="HTTP"/>
  10. <apikit:router config-ref="american-flights-api-config" doc:name="APIkit Router"/>
  11. <exception-strategy ref="american-flights-api-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/>
  12. </flow>
  13. <flow name="american-flights-api-console">
  14. <http:listener config-ref="american-flights-api-httpListenerConfig" path="/console/*" doc:name="HTTP"/>
  15. <apikit:console config-ref="american-flights-api-config" doc:name="APIkit Console"/>
  16. </flow>
  17. <flow name="put:/flights/{ID}:application/json:american-flights-api-config">
  18. <set-payload value="{&#xA;&quot;message&quot; : &quot;Flight updated (but not really)&quot;&#xA;}" doc:name="Set Payload"/>
  19. </flow>
  20. <flow name="delete:/flights/{ID}:american-flights-api-config">
  21. <set-payload value="{&#xA;&quot;message&quot; : &quot;Flight deleted (but not really)&quot;&#xA;}" doc:name="Set Payload"/>
  22. </flow>
  23. <flow name="get:/flights:american-flights-api-config">
  24. <set-payload value="[&#xA;{&#xA;&quot;ID&quot; : 1,&#xA;&quot;code&quot; : &quot;ER38sd&quot;,&#xA;&quot;price&quot; : 400,&#xA;&quot;departureDate&quot; : &quot;2017/07/26&quot;,&#xA;&quot;origin&quot; : &quot;CLE&quot;,&#xA;&quot;destination&quot; : &quot;SFO&quot;,&#xA;&quot;emptySeats&quot; : 0,&#xA;&quot;plane&quot; : {&#xA;&quot;type&quot; : &quot;Boeing 737&quot;,&#xA;&quot;totalSeats&quot; : 150&#xA;}&#xA;},&#xA;{&#xA;&quot;ID&quot; : 2,&#xA;&quot;code&quot; : &quot;ER45if&quot;,&#xA;&quot;price&quot; : 540.99,&#xA;&quot;departureDate&quot; : &quot;2017/07/27&quot;,&#xA;&quot;origin&quot; : &quot;SFO&quot;,&#xA;&quot;destination&quot; : &quot;ORD&quot;,&#xA;&quot;emptySeats&quot; : 54,&#xA;&quot;plane&quot; : {&#xA;&quot;type&quot; : &quot;Boeing 777&quot;,&#xA;&quot;totalSeats&quot; : 300&#xA;}&#xA;}&#xA;]" doc:name="Set Payload"/>
  25. </flow>
  26. <flow name="get:/flights/{ID}:american-flights-api-config">
  27. <set-payload value="{&#xA;&quot;ID&quot; : 1,&#xA;&quot;code&quot; : &quot;ER38sd&quot;,&#xA;&quot;price&quot; : 400,&#xA;&quot;departureDate&quot; : &quot;2017/07/26&quot;,&#xA;&quot;origin&quot; : &quot;CLE&quot;,&#xA;&quot;destination&quot; : &quot;SFO&quot;,&#xA;&quot;emptySeats&quot; : 0,&#xA;&quot;plane&quot; : {&#xA;&quot;type&quot; : &quot;Boeing 737&quot;,&#xA;&quot;totalSeats&quot; : 150&#xA;}&#xA;}" doc:name="Set Payload"/>
  28. </flow>
  29. <flow name="post:/flights:american-flights-api-config">
  30. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  31. <set-payload value="{&#xA;&quot;responsemesssage&quot; : &quot;Flight record added (honest joe, it's in there)&quot;&#xA;}" doc:name="Set Payload"/>
  32. </flow>
  33. <apikit:mapping-exception-strategy name="american-flights-api-apiKitGlobalExceptionMapping">
  34. <apikit:mapping statusCode="404">
  35. <apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
  36. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  37. <set-payload value="{ &quot;message&quot;: &quot;Resource not found&quot; }" doc:name="Set Payload"/>
  38. </apikit:mapping>
  39. <apikit:mapping statusCode="405">
  40. <apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException" />
  41. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  42. <set-payload value="{ &quot;message&quot;: &quot;Method not allowed&quot; }" doc:name="Set Payload"/>
  43. </apikit:mapping>
  44. <apikit:mapping statusCode="415">
  45. <apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
  46. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  47. <set-payload value="{ &quot;message&quot;: &quot;Unsupported media type&quot; }" doc:name="Set Payload"/>
  48. </apikit:mapping>
  49. <apikit:mapping statusCode="406">
  50. <apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
  51. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  52. <set-payload value="{ &quot;message&quot;: &quot;Not acceptable&quot; }" doc:name="Set Payload"/>
  53. </apikit:mapping>
  54. <apikit:mapping statusCode="400">
  55. <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
  56. <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
  57. <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set Payload"/>
  58. </apikit:mapping>
  59. </apikit:mapping-exception-strategy>
  60. </mule>
Advertisement
Add Comment
Please, Sign In to add comment