REST-Enabling Enterprise Data in the
Mobile Era
Ben Busse
Product Lead, DreamFactory
http://www.dreamfactory.com
Lessons learned
Reusable APIs
Mobile use case examples
What makes a good REST
API for mobile apps?
Lessons learned
Typical enterprise mobile project:
More than HALF of time spent on
backend integration and testing!
One-off APIs for each new project
slows you down
The problem is compounded by
mobile
Large enterprises need to deploy
THOUSANDS of mobile apps!
App 1
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
App 1
App 1
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
App 1 App 2
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
App 1 App 2
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
App 1 App 2 App 3
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
App 1 App 2 App 3 App 4
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
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
Client-Side
Team
Server-Side
Team
The Interface Negotiation
Testing
New
Application
Requirements
New
REST API
Services
App 1 App 2 App 3 App 4
File
Storage
SQL
Database
NoSQL
Documents
External
Services
NoSQL
Documents
External
Services
• 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
Reusable APIs for each new
project
speeds you up
Invert the problem
Start with the data, not the apps.
Reusable Set of REST APIs
App 1 App 2 App 3 App 4
File
Storage
SQL
Database
NoSQL
Documents
External
Services
Reusable Set of REST APIs
App 1 App 2 App 3 App 4
File
Storage
SQL
Database
NoSQL
Documents
External
Services
Reusable Set of REST APIs
App 1 App 2 App 3 App 4
File
Storage
SQL
Database
NoSQL
Documents
External
Services
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
Reusable APIs are a good thing!
Documented
Secure
Portable
Much less integration
Much less testing
What is a reusable REST
API?
Simple AND flexible
Consistently structured for
SQL, NoSQL, file stores
Designed for high transaction
volume
Support native mobile
and
web applications
Reusable APIs in practice
Noun-based endpoints and
HTTP verbs work great
SQL API Examples
Multiple
records
Single
records
Stored
procedures
& functions
NoSQL API Examples
Multiple
documents
Single
documents
File API Examples
Multiple
files
Single files
Manageable number of API
endpoints
SQL – 41
Files – 16
CRUD
NoSQL – 35
SQL: NoSQL +
{Schema,
Relations,
Procedures,
Functions}
NoSQL: Files +
{Filters}
Append parameters to endpoints
Dates
Filters
Pagination
Relationships
Files
Advanced Use Cases
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
Use case examples
Dates
?filter = ToDoDate >= '2015-05-01’ and ToDoDate <=
'2015-05-31’ & order = ToDoDate
Date Range Filter
Find ToDo
records in
the month
of May
Filters
?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”
Pagination
?limit = 100 & offset = 100 & order = Name
Pagination and Ordering
Load the
second 100
ToDo
records
sorted by
name
Relationships
https://www.myserver.com/rest/db-
api/Project?ids=348&related=Task
Fetch Parent-Child Relationships
Load a
project and
all related
tasks
/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)
{
"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
Files
https://www.myserver.com/rest/s3/applications/dreamteam-
docs/?
include_folders=true&include_files=true&full_tree=true
Files & Binary Objects
/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
Advanced Use Cases
Stored Procedures
Functions
Server-Side Scripts
Schema
Stored Procedures
Call procedure with parameters
Stored Functions
Call function with parameters
Server-Side Scripts
Custom business logic
Workflow triggers
Formula fields
Field validation
Remote web service
orchestration
Server-Side Scripts
Field validation
Workflow trigger
Schema
Operate on tables and fields
If you remember one thing….
Simplify development with
reusable APIs!
Thank You!
QUESTIONS
benbusse@dreamfactory.com
@benbusse

REST-Enabling Enterprise Data in the Mobile Era

Editor's Notes

  • #12 Now you want to build a new app. You didn’t know what app 2 was going to be when you built 1 Now, app 1 is in production. Don’t touch it! Also app 2 might be built by a totally different team of engineers!
  • #18 Interface negotiation is slow and difficult Had to build all this server-side software Results were bad And you can’t re-use the backend software for other apps in your company
  • #19 API Management Tools are not architected for transactional mobile use case.
  • #58 Maybe add end to end data flow