Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

REST-Enabling Enterprise Data in the Mobile Era

1,950 views

Published on

Ben Busse, product lead at DreamFactory, covers the importance of reusable REST APIs for enterprise mobile app development. Why are reusable APIs important, what are reusable APIs, and how do you use reusable APIs in practice. Ben gave this talk at the 2015 International PHP Conference in Berlin, Germany.

Published in: Software
  • Be the first to comment

REST-Enabling Enterprise Data in the Mobile Era

  1. 1. REST-Enabling Enterprise Data in the Mobile Era Ben Busse Product Lead, DreamFactory http://www.dreamfactory.com
  2. 2. Lessons learned Reusable APIs Mobile use case examples
  3. 3. What makes a good REST API for mobile apps?
  4. 4. Lessons learned
  5. 5. Typical enterprise mobile project: More than HALF of time spent on backend integration and testing!
  6. 6. One-off APIs for each new project slows you down
  7. 7. The problem is compounded by mobile Large enterprises need to deploy THOUSANDS of mobile apps!
  8. 8. App 1
  9. 9. File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services App 1
  10. 10. App 1 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  11. 11. App 1 App 2 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  12. 12. App 1 App 2 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  13. 13. App 1 App 2 App 3 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  14. 14. App 1 App 2 App 3 App 4 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  15. 15. API Complexity New APIs for every project Tightly linked to data sources Tightly linked to backend infrastructure Poorly documented Difficult to scale, not portable Many security vulnerabilities Server-side software development Time consuming interface negotiation
  16. 16. Client-Side Team Server-Side Team The Interface Negotiation Testing New Application Requirements New REST API Services
  17. 17. App 1 App 2 App 3 App 4 File Storage SQL Database NoSQL Documents External Services NoSQL Documents External Services
  18. 18. • API Creation Tools – Generates more complexity faster • API Management Tools – Introduces additional proxy endpoint – Increases overall complexity of the system – Still writing one-off APIs! • Mobile Device Management – Control the data, not the devices Complexity Band-Aids
  19. 19. Reusable APIs for each new project speeds you up
  20. 20. Invert the problem Start with the data, not the apps.
  21. 21. Reusable Set of REST APIs App 1 App 2 App 3 App 4 File Storage SQL Database NoSQL Documents External Services
  22. 22. Reusable Set of REST APIs App 1 App 2 App 3 App 4 File Storage SQL Database NoSQL Documents External Services
  23. 23. Reusable Set of REST APIs App 1 App 2 App 3 App 4 File Storage SQL Database NoSQL Documents External Services
  24. 24. Reusable APIs for any new project Customization for special cases Focus on front-end app development Decouple client-side from server-side Flexible backend infrastructure Flexible backend data sources Automatically documented Scalable, reliable, portable, secure Reusable API Approach
  25. 25. Reusable APIs are a good thing! Documented Secure Portable Much less integration Much less testing
  26. 26. What is a reusable REST API?
  27. 27. Simple AND flexible
  28. 28. Consistently structured for SQL, NoSQL, file stores
  29. 29. Designed for high transaction volume
  30. 30. Support native mobile and web applications
  31. 31. Reusable APIs in practice
  32. 32. Noun-based endpoints and HTTP verbs work great
  33. 33. SQL API Examples Multiple records Single records Stored procedures & functions
  34. 34. NoSQL API Examples Multiple documents Single documents
  35. 35. File API Examples Multiple files Single files
  36. 36. Manageable number of API endpoints SQL – 41 Files – 16 CRUD NoSQL – 35 SQL: NoSQL + {Schema, Relations, Procedures, Functions} NoSQL: Files + {Filters}
  37. 37. Append parameters to endpoints Dates Filters Pagination Relationships Files Advanced Use Cases
  38. 38. http://www.myserver.com/rest/oracleDB/Contacts?filter=la stName%20like%20‘jon%’&order=firstName Server Database Filter Parameter Other Parameters Request URL { “record”: [ { “firstName”: “Bob”, “lastName”: “Jones”, }, { “firstName”: “Susan”, “lastName”: “Jong”, }, ] } JSON Response Table
  39. 39. Use case examples
  40. 40. Dates
  41. 41. ?filter = ToDoDate >= '2015-05-01’ and ToDoDate <= '2015-05-31’ & order = ToDoDate Date Range Filter Find ToDo records in the month of May
  42. 42. Filters
  43. 43. ?filter = CreateDate = '2015-05-03’ and Archive = FALSE and ProjectName like ‘Next%’ Complex Filters Find active projects from yesterday where the name starts with “next”
  44. 44. Pagination
  45. 45. ?limit = 100 & offset = 100 & order = Name Pagination and Ordering Load the second 100 ToDo records sorted by name
  46. 46. Relationships
  47. 47. https://www.myserver.com/rest/db- api/Project?ids=348&related=Task Fetch Parent-Child Relationships Load a project and all related tasks
  48. 48. /db-api/table?ids=1013&related=childTable General Cases for Relationships GET Record and Child Records (1:M) /db-api/table?ids=467&related=siblingTableByJunction GET Record and Related Records (M:M via Junction Table)
  49. 49. { "record": [ { "contactId": 100, "firstName": "Adam", "lastName": "Ross", "contactinfos_by_contactId": [ { "infoId": 298, "contactId": 100, "infoType": "Home", "phone": "415-770-2025" }, { "infoId": 299, "contactId": 100, "infoType": "Work", "phone": "650-452-1668" } ] } ] } General Cases for Relationships POST / PUT Record and Child Records https://www.myserver.com/rest/db/contacts?rollback=true
  50. 50. Files
  51. 51. https://www.myserver.com/rest/s3/applications/dreamteam- docs/? include_folders=true&include_files=true&full_tree=true Files & Binary Objects
  52. 52. /files- api/container/folderName/?include_folders=true&in clude_files=true&full_tree=true General Cases for Files GET All Folders, Sub-Folders and Files in a Container /files-api/container/fullFilePath.fileType GET a File /files-api/container/fullFilePath.fileType POST a File
  53. 53. Advanced Use Cases Stored Procedures Functions Server-Side Scripts Schema
  54. 54. Stored Procedures Call procedure with parameters
  55. 55. Stored Functions Call function with parameters
  56. 56. Server-Side Scripts Custom business logic Workflow triggers Formula fields Field validation Remote web service orchestration
  57. 57. Server-Side Scripts Field validation Workflow trigger
  58. 58. Schema Operate on tables and fields
  59. 59. If you remember one thing…. Simplify development with reusable APIs!
  60. 60. Thank You! QUESTIONS benbusse@dreamfactory.com @benbusse

×