1 / 14

Writing remote API's

Writing remote API's. w ith ColdBox and REST. Kalen Gibbons. President of Sercossa Inc. A member of Team ColdBox. Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer. Value of the Model. Data is the most important part of your application. Exposing your model.

ted
Télécharger la présentation

Writing remote API's

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Writing remote API's with ColdBox and REST

  2. Kalen Gibbons • President of Sercossa Inc. • A member of Team ColdBox Co-Manager of IECFUG Flex, ColdFusion, JavaScript Developer

  3. Value of the Model Data is the most important part of your application

  4. Exposing your model • The web is evolving • Heavier front-end applications • Mobile • Frequent integrations • Requires more options • Standard page view (PV) model • REST (JSON, XML, etc) • AMF (raw data for Flash/Flex) • Many others

  5. Using REST Representational State Transfer

  6. Creating Routes • Config/routes.cfm • addRoute(pattern="/customers", handler="remote.customers", action={GET="getAllCustomers"}); • HTTP Verbs • GET, POST, PUT, DELETE • Can use existing handlers • But typically need to customize results

  7. Creating Handlers • Handlers know who to talk to • Use a base handler to make life easy • PreHandler : prepares data • PostHandler : marshals data • Exception Handling is required • Errors must be returned in the correct format • OnError : Handles exceptions and marshals data

  8. Exposing Data In new ways

  9. Example: AMF API’s • Action Message Format for Flash/Flex • Binary format for serializing CF objects to ActionScript • Acts 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

  10. Architectural Considerations Creating a reusable model

  11. What are Handler for? • Handler are Controllers • They know what data is required • They know who to talk to • Handlers are NOT for: • Business logic • Data processing • Mixing logic in your handles creates duplication

  12. Example Handlers 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

  13. A Better Architecture Business Services Data Services SQL Database SAP REST Service Other Sources

  14. Thanks Kalen@Sercossa.com @KalenGibbons

More Related