![Page 1: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/1.jpg)
Writing remote API'swith ColdBox and REST
![Page 2: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/2.jpg)
Kalen Gibbons
Co-Manager of IECFUG
Flex, ColdFusion, JavaScript Developer
A member of Team ColdBoxPresident of Sercossa Inc.
![Page 3: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/3.jpg)
Value of the ModelData is the most important part of your application
![Page 4: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/4.jpg)
Exposing your modelThe web is evolving
Heavier front-end applicationsMobileFrequent integrations
Requires more optionsStandard page view (PV) modelREST (JSON, XML, etc)AMF (raw data for Flash/Flex)Many others
![Page 5: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/5.jpg)
Using RESTRepresentational State Transfer
![Page 6: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/6.jpg)
Creating RoutesConfig/routes.cfm
addRoute(pattern="/customers", handler="remote.customers", action={GET="getAllCustomers"});
HTTP VerbsGET, POST, PUT, DELETE
Can use existing handlersBut typically need to customize results
![Page 7: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/7.jpg)
Creating HandlersHandlers know who to talk to
Use a base handler to make life easyPreHandler : prepares dataPostHandler : marshals data
Exception Handling is requiredErrors must be returned in the correct formatOnError : Handles exceptions and marshals data
![Page 8: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/8.jpg)
Exposing DataIn new ways
![Page 9: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/9.jpg)
Example: AMF API’sAction Message Format for Flash/Flex
Binary format for serializing CF objects to ActionScriptActs like a plain CFC method invocation
Uses ColdBox Proxy to enable the full ColdBox Request Life Cycles Allowing interceptors, AOP, etc. to work normally
Can extend remote functionality to suite needs
![Page 10: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/10.jpg)
Architectural Considerations
Creating a reusable model
![Page 11: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/11.jpg)
What are Handler for?Handler are Controllers
They know what data is requiredThey know who to talk to
Handlers are NOT for:Business logicData processing
Mixing logic in your handles creates duplication
![Page 12: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/12.jpg)
ExampleHandlers with logic Leveraging services
Security
Logging
Error Handling
Data manipulation
Security
Logging
Error Handling
Data manipulation
Security
Logging
Error Handling
Data manipulation Security
Logging
Error Handling
Data manipulation
![Page 13: With ColdBox and REST. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer A member of Team ColdBoxPresident of Sercossa Inc](https://reader035.vdocument.in/reader035/viewer/2022062619/5516c37c550346a25b8b61a6/html5/thumbnails/13.jpg)
A Better Architecture
SQL Database SAP REST Service Other Sources
Business Services
Data Services