Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mobile backend without REST

DAloG
April 26, 2017

Mobile backend without REST

DAloG

April 26, 2017
Tweet

More Decks by DAloG

Other Decks in Programming

Transcript

  1. TEXT SHORT HISTORY OF REST ▸ 1996 - developing the

    pattern ▸ 2000 - formalizing the pattern ▸ 2010 - spreading around the world. http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  2. TEXT REST REQUIREMENTS ▸ Client - Server ▸ No client

    state ▸ No client session on a client ▸ Caching (CDN and HTTP powered) ▸ Resource by URL / URI http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  3. TEXT MOBILE NEEDS ▸ Multiple Environments ▸ Versioning (multiple versions

    in store) ▸ Minimum logic on client side ▸ Sessions ▸ Feature toggles ▸ API Spec
  4. TEXT CONFIG SERVICE REQUEST "context": { "version": "1.0", "locale": "en_US",

    "bundle": "com.my.food-delivery", "device": "iPhone", "screen": { "width": 320, "height": 480 }, "uuid": "ABCD-1234-1242-1564", ... }
  5. TEXT CONFIG SERVICE RESPONSE "config": { "menu": { "search": {

    "url": "https://m.com/menu/v1/search", "context": { "session": "ABCD-1234-1242-1564", "currency": "USD" } }, "popular": [ ... ], ... }, ... }
  6. TEXT CONFIG SERVICE RESPONSE "error": { "kind": "temporal", "message": "We

    are updating our service, please wait up to 2 AM of tommorow." }
  7. TEXT CONFIG SERVICE RESPONSE "error": { "kind": "permanent", "message": "Please

    download new version from App Store", "action": "app store page" }
  8. TEXT SEARCH SERVICE RESPONSE "items": [ { "title": "Roll", "price":

    "18 USD", "markAsFavorite": { "url": "http://food.com/markAsFavorite", "context": { "id": 1990, "user": "ABCD-1234-1242-1564" } }, } ]
  9. TEXT NEXT STEPS ▸ Tell server about needed data ▸

    GraphQL ▸ Remote code injection
  10. TEXT CONFIG SERVICE REQUEST "context": { ... "menu": { "search":

    { "url": { "type": "$url" }, "json": { "type": "$object", "variables": ["$term"] } } } }
  11. TEXT CONFIG SERVICE RESPONSE "config": { "menu": { "search": {

    "url": "https://food-delivery.com/menu/v1/search", "json": { "term": "$term", "session": "ABCD-1234-1242-1564", "currency": "USD" } } } }