Evolution of API With Blogging YAPC::Asia Tokyo 2011 Takatsugu Shigeta YAPC::Asia Tokyo 2011 by Japan Perl Association is ...
Before starting my talk... I deeply apologize for not realizing to write some code. I mentioned below in a description of ...
 
Yeah... That's NOT stateless. I think that API should be stateless as REST. That pattern is asynchronized. I couldn't use ...
Please don't throw a chair like Steve Ballmer or kazeburo!
Evolution of API With Blogging YAPC::Asia Tokyo 2011 Takatsugu Shigeta YAPC::Asia Tokyo 2011 by Japan Perl Association is ...
Takatsugu Shigeta comewalk Some icons from http://icondock.com/ google-api-perl-client A moderator of gearman/MogileFS/Per...
Perl::Evolution
Movable Type 10 th  Anniversary!
Let's talk about  blogging  API!
Contents 1 1983–1993 2 1994–2001 3 2001–2004 4 2004–present 5 References http://en.wikipedia.org/wiki/History_of_blogging ...
1994-2001 The term "weblog" was coined by Jorn Barger on 17 Dec 1997.  The short form, "blog," was coi...
2001-2004 Movable Type was released in Oct 2001. By 2001, blogging community increased rapidly. http://en.wikipedia.org/wi...
2004
2011 YAPC::Asia Tokyo 2011 Evolution of API With Blogging
“ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.” -  Albert Eins...
Here we go!
 
 
 
Sample use Data::Dumper; use Net::Trackback::Client; use Net::Trackback::Ping; my $ping = Net::Trackback::Ping->new({ ping...
 
Sample use URI; use XML::Feed; my $uri = URI->new('http://example.com/rss.xml'); my $parser = XML::Feed->parse($uri); say ...
 
 
Sample use Data::Dumper; use XML::Feed; my $uri = 'http://example.com'; my @urls = XML::Feed->find_feeds($uri); say Dumper...
 
use URI; use XML::FOAF; my $uri = URI->new('http://example.com'); my $foaf = XML::FOAF->new($uri); say $foaf->person->nick...
Auto-Discovery <link rel=&quot; alternate &quot; type=&quot; application/atom+xml &quot; title=&quot;Atom&quot; href=&quot...
Sample use Data::Dumper; use WWW::Blog::Metadata; # seealso: perldoc WWW::Blog::Metadata use WWW::Blog::Metadata::RSD; My ...
Mobile Link Discovery <link rel=&quot; alternate &quot; media=&quot; handheld &quot; type=&quot;application/xhtml+xml&quot...
 
XMLRPC use Data::Dumper; use RPC::XML::Client; my $client = RPC::XML::Client->new('http://www.typepad.jp/t/api'); my $requ...
XMLRPC use Data::Dumper; use XMLRPC::Lite; my @result = XMLRPC::Lite ->proxy('http://www.typepad.com/t/api') ->call('mt.su...
AtomPub use XML::Atom::Client; use XML::Atom::Entry; my $entry = XML::Atom::Entry->new; $entry->title('This entry is poste...
WSSE my $nonce = $client->make_nonce; my $nonce_enc = encode_base64($nonce, ''); my $now = DateTime->now->iso8601 . 'Z'; m...
RSD <?xml version=&quot;1.0&quot;?> <rsd version=&quot;1.0&quot; xmlns=&quot;http://archipelago.phrasewise.com/rsd&quot;> ...
 
weblogUpdates Ping my $url = 'http://rpc.weblogs.com/RPC2'; my $req = HTTP::Request->new('POST', $url); $req->header('Cont...
OpenSearch <link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; href=&quot;http://example.c...
OpenID seealso Net::OpenID::Consumer
 
PubSubHubbub http://code.google.com/p/pubsubhubbub/
PubSubHubbub Implementations Publisher http://pubsubhubbub.googlecode.com/svn/trunk/ Hub http://pubsubhubbub.appspot.com/ ...
 
 
Trackback XMLRPC AtomPub Comment RSD weblogUpdates Ping Update Stream RSS Atom Activity Streams OpenSearch JSON PubSubHubb...
Full view
Anyway, Are you enjoying YAPC::Asia?
 
 
This is very precious to me in YAPC::Asia Tokyo 2011! Did you have anything like this? You should talk with ROCK STARS!
Okay, back to my talk
Further Progress of API
JSON XML is still used as structured data/representation like HTML But response of API is moving to JSON.
With Document Your service should provide API explorer with API documentation http://explorer.metacpan.org/ http://code.go...
PATCH Method PATCH method allows us to apply partial modifications to a resource. RFC5789 PATCH Method for HTTP http://www...
PATCH Method PATCH  /gists/:id { &quot;description&quot;: &quot;the description for this gist&quot;, &quot;files&quot;: { ...
And Also ... REST (HTTP verbs, Resource, URI) Authentication (OAuth2) Rate Limiting
And more... Performance Tips Using gzip Working with partial response http://code.google.com/apis/discovery/v1/performance...
Working With Partial Resource <ul><li>https://www.googleapis.com/demo/v1?key=YOUR-API-KEY </li></ul><ul><li>200 OK </li></...
Think New Specifications
Think Data Portability These formats couldn't resolve to clone our data completely Movable Type Import/Export Format WordP...
Import/Export Next Future? Camlistore is a way to store, sync, share, model and back up content http://camlistore.org/
Semantic Web Which tools?
Blogging World Is Still Fun, Let's Hack Together!
Kudos To CPAN Authors! Data::Dumper Net::Trackback HTTP::Request  Plagger LWP::UserAgent WWW::Search XML::Feed  WWW::Blog:...
Finally, I would like to introduce a module for you
google-api-perl-client Google APIs Client Library for Perl http://code.google.com/p/google-api-perl-client/ https://github...
use URI; use Google::API::Client; my $client = Google::API::Client->new; My $service = $client->build('urlshortener', 'v1'...
I WAS VERY VERY EXCITED! Joe Gregorio mentioned the module in his Google+ stream. Brad Fitzpatrick directly emailed me tha...
I'll keep updating the module. And, if you are a programmer, also you can write some code. Right?
That's all, Thank you!
I'm using USB- booted Ubuntu VOTE ME!
THANK YOU!
Upcoming SlideShare
Loading in...5
×

Evolution of API With Blogging

1,658

Published on

http://yapcasia.org/2011/talk/48

This talk is created by OpenOffice on Ubuntu. Including fonts are a little bit funny. Thank you for your interestings.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,658
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Evolution of API With Blogging

  1. 1. Evolution of API With Blogging YAPC::Asia Tokyo 2011 Takatsugu Shigeta YAPC::Asia Tokyo 2011 by Japan Perl Association is licensed under a Creative Commons Display - Non-Commercial 2.1 Japan License.
  2. 2. Before starting my talk... I deeply apologize for not realizing to write some code. I mentioned below in a description of my talk. “ I'll show you implementations of starman, Twiggy and TheSchwartz” But that didn't match my thoughts. I don't show you that in my talk.
  3. 4. Yeah... That's NOT stateless. I think that API should be stateless as REST. That pattern is asynchronized. I couldn't use that pattern in API.
  4. 5. Please don't throw a chair like Steve Ballmer or kazeburo!
  5. 6. Evolution of API With Blogging YAPC::Asia Tokyo 2011 Takatsugu Shigeta YAPC::Asia Tokyo 2011 by Japan Perl Association is licensed under a Creative Commons Display - Non-Commercial 2.1 Japan License.
  6. 7. Takatsugu Shigeta comewalk Some icons from http://icondock.com/ google-api-perl-client A moderator of gearman/MogileFS/Perlbal mailing lists http://blog.comewalk.com
  7. 8. Perl::Evolution
  8. 9. Movable Type 10 th Anniversary!
  9. 10. Let's talk about blogging API!
  10. 11. Contents 1 1983–1993 2 1994–2001 3 2001–2004 4 2004–present 5 References http://en.wikipedia.org/wiki/History_of_blogging History Of Blogging
  11. 12. 1994-2001 The term &quot;weblog&quot; was coined by Jorn Barger on 17 Dec 1997. The short form, &quot;blog,&quot; was coined by Peter Merholz in April or May 1999. LiveJournal was launched in Mar 1999. Blogger was launched in Aug 1999. http://en.wikipedia.org/wiki/History_of_blogging
  12. 13. 2001-2004 Movable Type was released in Oct 2001. By 2001, blogging community increased rapidly. http://en.wikipedia.org/wiki/History_of_blogging
  13. 14. 2004
  14. 15. 2011 YAPC::Asia Tokyo 2011 Evolution of API With Blogging
  15. 16. “ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.” - Albert Einstein 温故知新 - 孔子 Why?
  16. 17. Here we go!
  17. 21. Sample use Data::Dumper; use Net::Trackback::Client; use Net::Trackback::Ping; my $ping = Net::Trackback::Ping->new({ ping_url => 'http://example.com/trackback/1234/5678', url => 'http://example.com/blog/2011/10/post-1.html', title => 'Yet Another Trackback Test', description => 'This trackback which is generated by Net::Trackback.', }); my $client = Net::Trackback::Client->new; my $msg = $client->send_ping($ping); say Dumper($msg);
  18. 23. Sample use URI; use XML::Feed; my $uri = URI->new('http://example.com/rss.xml'); my $parser = XML::Feed->parse($uri); say $parser->as_xml;
  19. 26. Sample use Data::Dumper; use XML::Feed; my $uri = 'http://example.com'; my @urls = XML::Feed->find_feeds($uri); say Dumper(@urls);
  20. 28. use URI; use XML::FOAF; my $uri = URI->new('http://example.com'); my $foaf = XML::FOAF->new($uri); say $foaf->person->nick; Sample
  21. 29. Auto-Discovery <link rel=&quot; alternate &quot; type=&quot; application/atom+xml &quot; title=&quot;Atom&quot; href=&quot;http://example.com/atom.xml&quot; /> <link rel=&quot; alternate &quot; type=&quot; application/rss+xml &quot; title=&quot;RSS 1.0&quot; href=&quot;http://example.com/index.rdf&quot; /> <link rel=&quot; alternate &quot; type=&quot; application/rss+xml &quot; title=&quot;RSS 2.0&quot; href=&quot;http://example.com/rss.xml&quot; /> <link rel=&quot; openid.server &quot; href=&quot;http://example.com/openid/server&quot; /> <link rel=&quot; EditURI &quot; type=&quot; application/rsd+xml &quot; title=&quot;RSD&quot; href=&quot;http://example.com/rsd/123&quot; /> <link rel=&quot; meta &quot; type=&quot; application/rdf+xml &quot; title=&quot; FOAF &quot; href=&quot;http://example.com/foaf.rdf&quot; />
  22. 30. Sample use Data::Dumper; use WWW::Blog::Metadata; # seealso: perldoc WWW::Blog::Metadata use WWW::Blog::Metadata::RSD; My $uri = 'http://example.com'; my $meta = WWW::Blog::Metadata->extract_from_uri($uri); say Dumper($meta->feeds); say Dumper($meta->rsd_uri);
  23. 31. Mobile Link Discovery <link rel=&quot; alternate &quot; media=&quot; handheld &quot; type=&quot;application/xhtml+xml&quot; href=&quot;http://example.com/mobile&quot; /> WWW::Blog::Metadata::MobileLinkDiscovery http://www.sixapart.jp/docs/tech/mobile_link_discovery_en.html
  24. 33. XMLRPC use Data::Dumper; use RPC::XML::Client; my $client = RPC::XML::Client->new('http://www.typepad.jp/t/api'); my $request = RPC::XML::request->new( 'mt.supportedMethods', ); my $response = $client->send_request($request); say Dumper($response);
  25. 34. XMLRPC use Data::Dumper; use XMLRPC::Lite; my @result = XMLRPC::Lite ->proxy('http://www.typepad.com/t/api') ->call('mt.supportedMethods') ->result; say Dumper(@result);
  26. 35. AtomPub use XML::Atom::Client; use XML::Atom::Entry; my $entry = XML::Atom::Entry->new; $entry->title('This entry is posted by Atom.'); $entry->content('Atom Atom Atom Atom'); my $api = XML::Atom::Client->new; $api->username('YourUserName'); $api->password('YourPassword'); my $PostURI = &quot;http://example.com/atom/weblog/blog_id=YourBlogID&quot;; my $EditURI = $api->createEntry($PostURI, $entry);
  27. 36. WSSE my $nonce = $client->make_nonce; my $nonce_enc = encode_base64($nonce, ''); my $now = DateTime->now->iso8601 . 'Z'; my $digest = encode_base64(sha1($nonce . $now . ($client->password || '')), ''); $req->header(' X-WSSE ', sprintf qq( UsernameToken Username=&quot;%s&quot;, PasswordDigest=&quot;%s&quot;, Nonce=&quot;%s&quot;, Created=&quot;%s&quot; ), $client->username || '', $digest, $nonce_enc, $now); $req->header(' Authorization', 'WSSE profile=&quot;UsernameToken&quot; '); Code From XML::Atom::Client
  28. 37. RSD <?xml version=&quot;1.0&quot;?> <rsd version=&quot;1.0&quot; xmlns=&quot;http://archipelago.phrasewise.com/rsd&quot;> <service> <engineName>TypePad</engineName> <engineLink>http://www.typepad.com/</engineLink> <homePageLink>http://blog.comewalk.com/</homePageLink> <apis> <api name=&quot;Atom&quot; preferred=&quot;false&quot; apiLink=&quot;http://www.typepad.com/services/atom/svc=blogs/blog_id=123&quot; /> <api name=&quot;MetaWeblog&quot; preferred=&quot;true&quot; apiLink=&quot;http://www.typepad.com/services/xmlrpc&quot; blogID=&quot;123&quot; /> <api name=&quot;Blogger&quot; preferred=&quot;false&quot; apiLink=&quot;http://www.typepad.com/services/xmlrpc&quot; blogID=&quot;123&quot; /> <api name=&quot;MovableType&quot; preferred=&quot;false&quot; apiLink=&quot;http://www.typepad.com/services/xmlrpc&quot; blogID=&quot;123&quot; /> </apis> </service> </rsd>
  29. 39. weblogUpdates Ping my $url = 'http://rpc.weblogs.com/RPC2'; my $req = HTTP::Request->new('POST', $url); $req->header('Content-Type' => 'text/xml'); my $text = <<XML; <?xml version=&quot;1.0&quot;?> <methodCall> <methodName>weblogUpdates.ping</methodName> <params> <param><value>Foo::Bar</value></param> <param><value>http://example.com</value></param> </params> </methodCall> XML $req->content($text); my $ua = LWP::UserAgent->new; my $res = $ua->request($req);
  30. 40. OpenSearch <link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; href=&quot;http://example.com/opensearch/search.xml&quot; title=&quot;&quot; /> seealso WWW::OpenSearch
  31. 41. OpenID seealso Net::OpenID::Consumer
  32. 43. PubSubHubbub http://code.google.com/p/pubsubhubbub/
  33. 44. PubSubHubbub Implementations Publisher http://pubsubhubbub.googlecode.com/svn/trunk/ Hub http://pubsubhubbub.appspot.com/ Subscriber ttp://d.hatena.ne.jp/tokuhirom/20100307/push
  34. 47. Trackback XMLRPC AtomPub Comment RSD weblogUpdates Ping Update Stream RSS Atom Activity Streams OpenSearch JSON PubSubHubbub OpenID OAuth WSSE FOAF oEmbed OPML Auto-Discovery Mobile Link Discovery microformats
  35. 48. Full view
  36. 49. Anyway, Are you enjoying YAPC::Asia?
  37. 52. This is very precious to me in YAPC::Asia Tokyo 2011! Did you have anything like this? You should talk with ROCK STARS!
  38. 53. Okay, back to my talk
  39. 54. Further Progress of API
  40. 55. JSON XML is still used as structured data/representation like HTML But response of API is moving to JSON.
  41. 56. With Document Your service should provide API explorer with API documentation http://explorer.metacpan.org/ http://code.google.com/apis/explorer/ https://developer.foursquare.com/docs/explore.html
  42. 57. PATCH Method PATCH method allows us to apply partial modifications to a resource. RFC5789 PATCH Method for HTTP http://www.ietf.org/rfc/rfc5789.txt e.g.) http://developer.github.com/v3/#http-verbs
  43. 58. PATCH Method PATCH /gists/:id { &quot;description&quot;: &quot;the description for this gist&quot;, &quot;files&quot;: { &quot;file1.txt&quot;: { &quot;content&quot;: &quot;updated file contents&quot; }, &quot;old_name.txt&quot;: { &quot;filename&quot;: &quot;new_name.txt&quot;, &quot;content&quot;: &quot;modified contents&quot; }, &quot;new_file.txt&quot;: { &quot;content&quot;: &quot;a new file&quot; }, &quot;delete_this_file.txt&quot;: null } } http://developer.github.com/v3/gists/
  44. 59. And Also ... REST (HTTP verbs, Resource, URI) Authentication (OAuth2) Rate Limiting
  45. 60. And more... Performance Tips Using gzip Working with partial response http://code.google.com/apis/discovery/v1/performance.html
  46. 61. Working With Partial Resource <ul><li>https://www.googleapis.com/demo/v1?key=YOUR-API-KEY </li></ul><ul><li>200 OK </li></ul><ul><li>{ </li></ul><ul><li>&quot;kind&quot;: &quot;demo&quot;, </li></ul><ul><li>... </li></ul><ul><li>&quot;items&quot;: [ </li></ul><ul><li>{ </li></ul><ul><li>&quot;title&quot;: &quot;First title&quot;, </li></ul><ul><li>&quot;comment&quot;: &quot;First comment.&quot;, </li></ul><ul><li>&quot;characteristics&quot;: { </li></ul><ul><li>&quot;length&quot;: &quot;short&quot;, </li></ul><ul><li>&quot;accuracy&quot;: &quot;high&quot;, </li></ul><ul><li>&quot;followers&quot;: [&quot;Jo&quot;, &quot;Will&quot;], </li></ul><ul><li>}, </li></ul><ul><li>&quot;status&quot;: &quot;active&quot;, </li></ul><ul><li>... </li></ul><ul><li>}, </li></ul><ul><li>{ </li></ul><ul><li>&quot;title&quot;: &quot;Second title&quot;, </li></ul><ul><li>&quot;comment&quot;: &quot;Second comment.&quot;, </li></ul><ul><li>&quot;characteristics&quot;: { </li></ul><ul><li>&quot;length&quot;: &quot;long&quot;, </li></ul><ul><li>&quot;accuracy&quot;: &quot;medium&quot; </li></ul><ul><li>&quot;followers&quot;: [ ], </li></ul><ul><li>}, </li></ul><ul><li>&quot;status&quot;: &quot;pending&quot;, </li></ul><ul><li>... </li></ul><ul><li>}, </li></ul><ul><li>... </li></ul><ul><li>] </li></ul><ul><li>}} </li></ul><ul><li>https://www.googleapis.com/demo/v1?key=YOUR-API-KEY& fields=kind,items(title,characteristics/length) </li></ul><ul><li>200 OK </li></ul><ul><li>{ </li></ul><ul><li>&quot;kind&quot;: &quot;demo&quot;, </li></ul><ul><li>&quot;items&quot;: [ </li></ul><ul><li>{ </li></ul><ul><li>&quot;title&quot;: &quot;First title&quot;, </li></ul><ul><li>&quot;characteristics&quot;: { </li></ul><ul><li>&quot;length&quot;: &quot;short&quot; </li></ul><ul><li>} </li></ul><ul><li>}, </li></ul><ul><li>{ </li></ul><ul><li>&quot;title&quot;: &quot;Second title&quot;, </li></ul><ul><li>&quot;characteristics&quot;: { </li></ul><ul><li>&quot;length&quot;: &quot;long&quot; </li></ul><ul><li>} </li></ul><ul><li>}, </li></ul><ul><li>... </li></ul><ul><li>] </li></ul><ul><li>} </li></ul>
  47. 62. Think New Specifications
  48. 63. Think Data Portability These formats couldn't resolve to clone our data completely Movable Type Import/Export Format WordPress eXtended RSS Format Atom (Blogger) Import/Export
  49. 64. Import/Export Next Future? Camlistore is a way to store, sync, share, model and back up content http://camlistore.org/
  50. 65. Semantic Web Which tools?
  51. 66. Blogging World Is Still Fun, Let's Hack Together!
  52. 67. Kudos To CPAN Authors! Data::Dumper Net::Trackback HTTP::Request Plagger LWP::UserAgent WWW::Search XML::Feed WWW::Blog::Metadata ( Web::Scraper) XML::Atom RPC::XML XMLRPC::Lite Especially, miyagawa++ Perl Modules I Mentioned
  53. 68. Finally, I would like to introduce a module for you
  54. 69. google-api-perl-client Google APIs Client Library for Perl http://code.google.com/p/google-api-perl-client/ https://github.com/comewalk/google-api-perl-client/
  55. 70. use URI; use Google::API::Client; my $client = Google::API::Client->new; My $service = $client->build('urlshortener', 'v1'); # Create a shortened URL by inserting the URL into the url collection. my $body = { 'longUrl' => 'http://code.google.com/apis/urlshortener/', }; my $res = $service->url->insert(body => $body)->execute; say 'short url is' . $res->{'id'};
  56. 71. I WAS VERY VERY EXCITED! Joe Gregorio mentioned the module in his Google+ stream. Brad Fitzpatrick directly emailed me that he can help me the module by code review or something like that.
  57. 72. I'll keep updating the module. And, if you are a programmer, also you can write some code. Right?
  58. 73. That's all, Thank you!
  59. 74. I'm using USB- booted Ubuntu VOTE ME!
  60. 75. THANK YOU!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×