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

Uniform Interface

Z
July 11, 2017

Uniform Interface

The deck during my presentation at Hive Talks Prague https://www.meetup.com/apiaryio/events/240962821/

Z

July 11, 2017
Tweet

More Decks by Z

Other Decks in Programming

Transcript

  1. GOOD API THE UNIFORM INTERFACE REFERS TO A STANDARD WAY

    TO DO SOMETHING REGARDLESS OF WHAT THE SPECIFIC ACTIVITY IS
  2. GOOD API A CONSISTENT, PREDICTABLE WAY TO QUERY DATA AND

    EXERCISE ACTIONS REGARDLESS OF THE APPLICATION DOMAIN
  3. GOOD API NO CLIENT REUSE New API 㱺 New client,

    albeit the API is within the same domain Smart Pallet Vendor A Smart Pallet Vendor B
  4. GOOD API AUTONOMOUS SERVICE DISCOVERY “Get me a service that

    knows weather in Paris.” “Get me a service that can fulfill the parcel logistics of 6 pallets from Prague to Paris.” “Get me a service that can play every movies by the director of movie Avatar.”
  5. GOOD API THIS IS WHAT AMAZON ALEXA SKILLS, GOOGLE HOME

    SKILLS & VIV ARE DOING BUILD A DATABASE OF KNOWLEDGE AND SERVICES WITH UNIFORM INTERFACE…
  6. GOOD API UNLESS YOU ARE REALLY COUNTING BITS, WATTS OR

    MILLISECONDS THE UI’S BENEFITS OUTWEIGHS THE TRADEOFF
  7. GOOD API HOW TO ACHIEVE CONSISTENT INTERFACE • SOAP (Tunneling

    architectural style) • REST (Hypermedia architectural style) • Query Languages (Tunneling architectural styles) • Proprietary function libraries (RPC architectural style) • Domain-specific standards (on top of a respective style)
  8. GOOD API SOAP • Uniform Interface is not part of

    SOAP • Added on the application level of service qualities • Security: WS-Security/SecureConversation/Trust • Transactions: WS-AtomicTransaction and WS-BusinessActivity
  9. GOOD API REST UI CONSTRAINTS • Identification of Resources •

    Manipulation Through Representations • Self Descriptive Messages • HATEOAS
  10. GOOD API HATEOAS 1. All application state is kept on

    the client side. Changes to application state are the client’s responsibility 2. The client can only change its application state by making an HTTP request and processing the response. 3. How does the client know which requests it can make next? By looking at the hypermedia controls in the representations it’s received so far. 4. Therefore, hypermedia controls are the driving force behind changes in application state. Credit: RESTful Web APIs by Richardson & Amundsen
  11. GOOD API REST ARCHITECTURAL STYLE • Great in theory •

    In reality very few follows the UI constraints, making the interfaces incompatible • Workarounds possible via explicit standards & governance e.g. Oracle+Apiary API Style Guide
  12. GOOD API SQL IS THE UNIFORM INTERFACE TO RETRIEVE AND

    MANIPULATE DATA REGARDLESS OF WHAT THE DATA ARE
  13. GOOD API DATA IDENTIFIERS ARE MORE HYPERMEDIA THAN URI* “URIs”

    of GraphQL are opaque: ID or “path” + ID (Relay route) * true for HTTP/LCODC$SS APIs
  14. GOOD API NO VERSIONING “GraphQL takes a strong opinion on

    avoiding versioning by providing the tools for the continuous evolution of a GraphQL schema.” http://graphql.org/learn/best-practices/
  15. GOOD API MYTH: OVERFETCHING If you are worried about over-fetching

    you are probably using wrong protocol. GraphQL
  16. GOOD API MISSING SOME OF THE REST SYSTEM QUALITIES COD

    & $ which translates to the loss of extensibility and cache-ability
  17. GOOD API GraphQL GraphQL out of the box provides Uniform

    Interface and thus results in systems with: 1. Simplified Architecture 2. Increased Components Visibility 3. Decoupled Components
  18. GOOD API GOOD API In fact, GraphQL is so good

    at providing UI, I wanted to take it and create the easiest way for everybody to get to the uniform interface…
  19. GOOD API GOOD API Serverless API to provide Uniform Interface

    on top of existing data, functions and services http://deira.ai