Gary Gao: APIs Are Good

Tags:

Preview:

Citation preview

APIs are good

API?That’s nice, but what is an

<?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

<?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 $'; } }

Structured ways of

doing

something

with software

Example

GOOD?But why are they

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

things

librarything

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

goodreads

APIs are goodawesome

FOLKSThat’s all,