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

Build better API clients

Build better API clients

Some thoughts on building better API clients, talk given at APIDays Berlin 2015.

Boris Bügling

April 24, 2015
Tweet

More Decks by Boris Bügling

Other Decks in Programming

Transcript

  1. /** The server address to use for accessing any resources.

    Default value: "cdn.contentful.com" */ @property (nonatomic) NSString* server; /** Configure a custom user-agent to be used in the HTTP request headers */ @property (nonatomic) NSString* userAgent;
  2. ▸ Offers us to create a question ▸ We can

    fill in the form we get ▸ Submit the form
  3. SIREN LINK { "entities": [ { "links": [ { "rel":

    ["self"], "href": "questions/1/choices/1" } ], "rel": ["choices"], "properties": { "choice": "Swift", "votes": 22 } } ] }
  4. SIREN ACTION { "actions": { "create": { "href": "/questions", "method":

    "POST", "fields": [ { "name": "question" }, { "name": "choices" } ], "type": "application/x-www-form-urlencoded" } } }
  5. ATTRIBUTES OF A TRANSITION if let transition = representor.transitions["create"] {

    transition.method transition.uri transition.suggestedContentType }
  6. WHAT HAVE WE LEARNED? ▸ Publish source code! ▸ Document!

    ▸ Test! ▸ Be robust against change!