Mine and Jason's talk from BarCampBrighton 5 about building brilliant APIs that bloody work.
Probably won't make sense without having been there..
Any questions give myself (@ben_c) or Jason (@fry15) a shout on twitter.
10. But...
“I’m not planning on building an API yet so
why should I care?”
Monday, 4 October 2010
11. What Makes a Brilliant
API?
Monday, 4 October 2010
12. Naming
• Use descriptive meaningful names
• Don’t be afraid to use really long names
http://ws.audioscrobbler.com/2.0/?
method=user.gettopalbums&user=rj
Monday, 4 October 2010
13. Building URLs
• Base URI
• e.g. api.twitter.com/v2/
• Method
• e.g. statuses/user_timeline.xml
Monday, 4 October 2010
14. Responses
• XML / JSON
• Clear structure
Monday, 4 October 2010
16. Error Codes
• Numbers which mean something
• Success, error
• Missing parameter x
• Parameter x must be 3 characters long
• etc etc
Monday, 4 October 2010
17. Types of APIs
• SOAP
• RESTful
Monday, 4 October 2010
18. Types of APIs
SOAP
Simple Object Access Protocol
Monday, 4 October 2010
19. Types of APIs
RESTful
Representable State Transfer
Monday, 4 October 2010
20. RESTful
Based on HTTP Request protocol
Monday, 4 October 2010
21. RESTful
Based on HTTP Request protocol
PUT DELETE GET POST
Monday, 4 October 2010
22. RESTful
Based on HTTP Request protocol
GET POST
DELETE
PUT
Monday, 4 October 2010
23. RESTful
Based on HTTP Request protocol
GET POST
Monday, 4 October 2010
24. Versioning
• API version in URL
• eg http://locationtextvideoapi.com/2.0/
• Allows backwackwards compatibility
without sacrificing future versions
Monday, 4 October 2010
25. Authentication
• Two choices
• OAuth
• Basic (http / session)
Monday, 4 October 2010
48. Thanks
Ben Collier Jason Fry
me@bencollier.net jason@jasonfry.co.uk
@ben_c @fry15
Monday, 4 October 2010
49. Thanks
Ben Collier Jason Fry
me@bencollier.net jason@jasonfry.co.uk
@ben_c @fry15
Bubble Image- http://www.flickr.com/photos/philippbunge/
Hammock- http://www.flickr.com/photos/ironrodart/
Padlock- http://www.flickr.com/photos/sooperkuh/
Binary Windows - http://www.flickr.com/photos/
9619972@N08/
Boxing Lemur - http://www.flickr.com/photos/e_phots/
Earth from Space - NASA
Monday, 4 October 2010