gary gao: apis are good

12
APIs are good

Upload: talnoznisky

Post on 27-May-2015

78 views

Category:

Technology


0 download

Tags:

TRANSCRIPT

Page 1: Gary Gao: APIs Are Good

APIs are good

Page 2: Gary Gao: APIs Are Good

API?That’s nice, but what is an

Page 3: Gary Gao: APIs Are Good

<?php class Api<module name> extends ApiBase { public function __construct( $main, $action ) { parent::__construct( $main, $action ); } public function execute() { } public function getAllowedParams() { return array( '<parameter name>' => array( ApiBase::PARAM_TYPE => array( 'foo', 'bar', 'baz' ), ), ); } public function getParamDescription() { return array( '<parameter name>' => '<parameter description>', ); } public function getDescription() { return '<Module description here>'; } public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'code' => '<error code>', 'info' => '<error description>' ), ) ); } public function getExamples() { return array( 'api.php?action=<module name>&<parameter anme>=foo' ); } public function getHelpUrls() { return ''; } public function getVersion() { return __CLASS__ . ': $Id: ApiParse.php 109693 2012-01-21 21:36:07Z reedy $'; } }

Application Programming Interface

Page 4: Gary Gao: APIs Are Good

<?php class Api<module name> extends ApiBase { public function __construct( $main, $action ) { parent::__construct( $main, $action ); } public function execute() { } public function getAllowedParams() { return array( '<parameter name>' => array( ApiBase::PARAM_TYPE => array( 'foo', 'bar', 'baz' ), ), ); } public function getParamDescription() { return array( '<parameter name>' => '<parameter description>', ); } public function getDescription() { return '<Module description here>'; } public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'code' => '<error code>', 'info' => '<error description>' ), ) ); } public function getExamples() { return array( 'api.php?action=<module name>&<parameter anme>=foo' ); } public function getHelpUrls() { return ''; } public function getVersion() { return __CLASS__ . ': $Id: ApiParse.php 109693 2012-01-21 21:36:07Z reedy $'; } }

Page 5: Gary Gao: APIs Are Good

Structured ways of

doing

something

with software

Page 6: Gary Gao: APIs Are Good

Example

Page 7: Gary Gao: APIs Are Good

GOOD?But why are they

Page 8: Gary Gao: APIs Are Good

31. APIs are tools2. APIs make data available3. APIs can make your tools better

things

Page 9: Gary Gao: APIs Are Good

librarything

http://covers.librarything.com/devkey/c6e21db4bcabaccd1925b3aeb169b9a/large/isbn/0679743464 =

Page 10: Gary Gao: APIs Are Good

goodreads

Page 11: Gary Gao: APIs Are Good

APIs are goodawesome

Page 12: Gary Gao: APIs Are Good

FOLKSThat’s all,