Dmackenzie ignite

Post on 16-Apr-2017

276 views 1 download

transcript

Twitter’s RESTful APIDuncan Mackenzie

Vocab:

API: Application Programming Interface

REST: Representational State Transfer

What is REST?A style, not a specification.

How can I be RESTful?• Use HTTP methods explicitly.• Be stateless.• Expose directory structure-like URIs.• Transfer XML, (JSON), or both.

HTTP Methods Explicitly

GET /addaccount?type=savings HTTP/1.1

HTTP Methods Explicitly

POST /users HTTP/1.1 Host: myserver Content-Type: application/xml <?xml version="1.0"?> <account>

<type>savings</type> </account>

Be Stateless

SRC: IBM DevWorks

Be Stateless

SRC: IBM DevWorks

Transfer XML, JSON, or both

Directory-structure-esque URIs

Alternatives?

Simple Object Access Protocol

https://twitter.com/users/show/duncanjm703.json

https://twitter.com/users/show/duncanjm703.json

https://twitter.com/users/show/duncanjm703.json

That’s it?

The Firehose: You no can has

The Future: OMG SO WEB 3.0

Questions?

Sources: IBM developerWorks Twitter API FAQ and DocumentationRaffi Krikorian’s Slideshare on the annotation APILots’a GIS