RESTful Applications

Past, Present and Future.

v2.0.1

#fstoco Encore!

This guy again!?

Ahmad Nassri

GET /who HTTP/1.1
Host: www.ahmadnassri.com
Accept: application/json

HTTP/1.1 200 OK
Date: Sat, 22 Nov 2014 15:15:00 GMT
Content-Type: application/json

{
  "name": "Ahmad Nassri",
  "website": "http://www.ahmadnassri.com/",
  "twitter": "http://twitter.com/ahmadnassri",
  "email": "ahmad@ahmadnassri.com",
  "bio": "Technologist, Entrepreneur, Dog Lover",
  "work": {
    "company": "Mashape.com",
    "title": "API Master"
  }
}

Consume, Monitor, Manage, Monetize and Distribute Private and Public APIs.

AWESOME TOOLS

Guardian.js

Public APIs

JSON Generator

REST Console

Oauth Bible

API Glossary

UNIREST

API Analytics

Contest

Tweet: link to each awesome API Tool with:
cc: @Mashape @AhmadNassri #fstoco
 

First Tweet for each link wins awesome T-Shirt / Book!

History

In Egyptian mythology, Apis, is a bull-deity that was worshipped in the Memphis region. Apis served as an intermediary between humans and an all-powerful god.

Egyptology?!

an application programming interface (API) is a set of routines, protocols, and tools for building software applications.

Computer Programming

Web Services

A Web service is a method of communication between two electronic devices over a network. It is a software function provided at a network address over the web with the service always on.

RESTful Web APIs

REST (REpresentational State Transfer) is a simple stateless architecture style that generally runs over HTTP.

PRESENT

1991: Started as notes written by Tim Berners Lee.

1996: First standard HTTP/1.0 version (RFC 1945).

1999: HTTP/1.1 (RFC 2616) & REST

2000: REpresential State Transfer by Roy Fielding

2007: Refactoring with HTTP/1.1 bis

2009: SPDY by Google

2012: IETF working group released draft of HTTP/2

June 2014: RFC2616 is Dead!

HTTP Timeline

  • Core Specifications
    • RFC7230 - HTTP/1.1: Message Syntax and Routing
    • RFC7231 - HTTP/1.1: Semantics and Content
  • Optional / Widely Used
    • RFC7232 - HTTP/1.1: Conditional Requests
    • RFC7233 - HTTP/1.1: Range Requests
    • RFC7234 - HTTP/1.1: Caching
    • RFC7235 - HTTP/1.1: Authentication

These RFCs collectively obsolete all preceding RFCs defining HTTP, including RFC1945, RFC2068 and RFC2616.

http://httpwg.github.io

RFC 2616 > RFC 723*

Future

HTTP/2

HTTP 2.0 is a protocol designed for low-latency transport of content over the World Wide Web

Twitter: SPDY + iOS

we have measured as much as a 30% decrease in latency in the wild for API requests carried over SPDY relative to those carried over HTTP. In particular, we’ve observed SPDY helping more as a user’s network conditions get worse.

https://blog.twitter.com/2013/cocoaspdy-spdy-for-ios-os-x

HTTP/2 is ready

TODAY!

HTTP/2 RFC Last Call as of Aug 2014

Hypermedia Hype

Collection+JSON

Hypertext Application Language (HAL)

ATOM

Best PRactices

for building RESTful APIs

GET /player/1234567890 HTTP/1.1

{
    "@context": {
        "@vocab": "https://schema.org/",
        "image": { "@type": "@id" },
        "friends": { "@type": "@id" }
    },
    "@id": "https://api.example.com/player/1234567890",
    "playerId": "1234567890",
    "name": "Kevin Sookocheff",
    "alternateName": "soofaloofa",
    "image": "https://api.example.com/player/1234567890/avatar.png",
    "friends": "https://api.example.com/player/1234567890/friends"
}

JSON-LD

GET /player/1234567890/friends HTTP/1.1

{
    "@context": [
        "http://www.w3.org/ns/hydra/core",
        {
            "@vocab": "https://schema.org/",
            "image": { "@type": "@id" },
            "friends": { "@type": "@id" }
        }
    ],

    "@id": "https://api.example.com/player/1234567890/friends",
    "operation": {
        "@type": "BefriendAction",
        "method": "POST",
        "expects": {
            "@id": "http://schema.org/Person",
            "supportedProperty": [
                { "property": "name", "range": "Text" },
                { "property": "alternateName", "range": "Text" },
                { "property": "image", "range": "URL" }
            ]
        }
    },

    "member": [
        {
            "@id": "https://api.example.com/player/1895638109",
            "name": "Sheldon Dong",
            "alternateName": "sdong",
            "image": "https://api.example.com/player/1895638109/avatar.png",
            "friends": "https://api.example.com/player/1895638109/friends"
        },
        {
            "@id": "https://api.example.com/player/8371023509",
            ...
        }
    ],
    "nextPage": "https://api.example.com/player/1234567890/friends?page=2"
}

JSON-LD + HYDRA

Authentication

RFC 2617

# URL Versioning:

GET /api/v2/foo HTTP/1.1

# Custom Header:

GET /api/foo
X-VERSION: 2

# Content Type

GET: /api/foo
Accept: application/vnd.github.v3.raw+json

Versioning

Your API is a product!

Clear Docs

Simple Pricing

Availability

Support & Community

Contest

Tweet: Top 5 features of a great API Product with:
cc: @Mashape @AhmadNassri #fstoco
 

First Tweet for each link wins awesome T-Shirt / Book!

Thank you

Stalk me on Twitter

@AhmadNassri

 

Read more on my blog

www.ahmadnassri.com

 

Follow my APIs on Mashape

mashape.com/AhmadNassri

RESTful Applications, Past, Present and Future (Fullstack Toronto Encore)

By Ahmad Nassri

RESTful Applications, Past, Present and Future (Fullstack Toronto Encore)

  • 960