5. Desktop:
250 kb – Avg. Page Weight
2.5 pages – Avg. number Per Visit
Total = 625 Kb Bandwidth Per Visit
Mobile:
100 kb – Avg. Page Weight
10 pages- Avg. number per visit
Total = 1 Mb Bandwidth per visit
6. We want to keep the best user experience at all time.
Nobody wants an unresponsive app.
The efficient API make a huge Impact on
Performance for Mobile App Specially.
When the API is too lazy or Incomplete the burden is
put on the mobile App.
Any Workaround for it, put stress on the app which
consumes too much resources.
7. Too Slow
Too Much Complicated to Parse
Dependent on 3rd Party
Data is not Cache
DB is not efficient like Indexing
DB Query is not Efficient like Join
8. Be Simple
Be Fast
Use of Caching
Load Needed Data Only
Think as Service not as Methods
9. Easy to maintain API
Easy to make changes in API & Debugging
Easy to add , remove or change Functionality
Enable user for backward support
API becomes more reliable
10. Use LIMIT & OFFSET
Enable Flexibility for User
Data is Less & API becomes FAST
E.g. GET /properties?offset=10&limit=5
11. E.g. For Login API
1) Passing Credential & Get Session Token
2) Get User Data after passing Valid Session Token
Instead Of This
Check Credential & Pass Data with Session Token
Session Token will use by future API Calls
12. E.g. Application Start up
Think when multiple APIs calls on Application Start up
Hard to Maintain & Parse
If some API calls fails
Instead Of This
Combine Multiple request into Single
Easy to Maintain & Parse
Easy to Handle Failure
13. Mobile shows very less attributes on the screen.
It don’t require all the fields.
Fields Selection gives ability to API consumer to
get desire data
E.g.
GET /cars?fields=manufacturer,model,id,color
14. Secure Data Transit
Secure your Data while changing by API
Use Access Token
Malicious data having unintended consequences
15. Load Data which are need to Display
Load Images,files Asynchronously
It affects Latency Time of API
It affects User Experience
Avoids unnecessary condition checking
saves User Time
saves User Data charge Amount
16. Helps in Debug Error
Use standard format that Self Explanatory
Helps in Recovery from failure
E.g.
{
"http_code": "401",
“User_message" : “Email does not exits",
"internal_message" : “Authentication Failed"
}
17. Status Code Value Meaning
200 OK Working fine
201 OK New resource
Created
204 OK Successfully
Deleted
304 Not Modified Use Cache Data
400 Bad Request Invalid
401 Unauthorized Authentication
Failed
403 Forbidden Refuse Request
404 Not Found No resource
500 Internal Server
Error
Server Error
18. Might be hardest job
It should be precise, correct & easy to understand
Update when API changes made
Saves lots of time in implementation
Show sample code
Better for future