SlideShare ist ein Scribd-Unternehmen logo
1 von 75
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.
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.
 
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.
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 licensed under a Creative Commons Display - Non-Commercial 2.1 Japan License.
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
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 History Of Blogging
1994-2001 The term "weblog" was coined by Jorn Barger on 17 Dec 1997.  The short form, "blog," 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
2001-2004 Movable Type was released in Oct 2001. By 2001, blogging community increased rapidly. http://en.wikipedia.org/wiki/History_of_blogging
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 Einstein 温故知新 -  孔子 Why?
Here we go!
 
 
 
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);
 
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;
 
 
Sample use Data::Dumper; use XML::Feed; my $uri = 'http://example.com'; my @urls = XML::Feed->find_feeds($uri); say Dumper(@urls);
 
use URI; use XML::FOAF; my $uri = URI->new('http://example.com'); my $foaf = XML::FOAF->new($uri); say $foaf->person->nick; Sample
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; />
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);
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
 
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);
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);
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);
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
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>
 
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);
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
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/ Subscriber ttp://d.hatena.ne.jp/tokuhirom/20100307/push
 
 
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
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.google.com/apis/explorer/ https://developer.foursquare.com/docs/explore.html
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
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/
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.html
Working With Partial Resource ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Think New Specifications
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
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::Metadata ( Web::Scraper) XML::Atom RPC::XML XMLRPC::Lite   Especially, miyagawa++ Perl Modules I Mentioned
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.com/comewalk/google-api-perl-client/
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'};
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.
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!

Weitere ähnliche Inhalte

Was ist angesagt?

Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
mussawir20
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
inovex GmbH
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
nicdev
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAML
Jon Dean
 

Was ist angesagt? (20)

Php 3 1
Php 3 1Php 3 1
Php 3 1
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
 
Django
DjangoDjango
Django
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
 
symfony & jQuery (phpDay)
symfony & jQuery (phpDay)symfony & jQuery (phpDay)
symfony & jQuery (phpDay)
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIs
 
Meetup django common_problems(1)
Meetup django common_problems(1)Meetup django common_problems(1)
Meetup django common_problems(1)
 
HTML 5 & CSS 3
HTML 5 & CSS 3HTML 5 & CSS 3
HTML 5 & CSS 3
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
Building Secure Twitter Apps
Building Secure Twitter AppsBuilding Secure Twitter Apps
Building Secure Twitter Apps
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for Translation
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Qpsmtpd
QpsmtpdQpsmtpd
Qpsmtpd
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAML
 

Andere mochten auch

GEOMETRY_ARHIMED
GEOMETRY_ARHIMEDGEOMETRY_ARHIMED
GEOMETRY_ARHIMED
viktoriya71
 
E-portfolio interoperability and the advance of Leap2A
E-portfolio interoperability and the advance of Leap2AE-portfolio interoperability and the advance of Leap2A
E-portfolio interoperability and the advance of Leap2A
Simon Grant
 
Red House & West Gate
Red House & West GateRed House & West Gate
Red House & West Gate
Yi-Chi Tang
 
Challenges of educational open data
Challenges of educational open dataChallenges of educational open data
Challenges of educational open data
Simon Grant
 
GTX_Brand_BreatheSweeps_
GTX_Brand_BreatheSweeps_ GTX_Brand_BreatheSweeps_
GTX_Brand_BreatheSweeps_
Josue Sierra
 
Alcesti -Fenomeni Franosi (Prof. Capponi)
Alcesti -Fenomeni Franosi (Prof. Capponi)Alcesti -Fenomeni Franosi (Prof. Capponi)
Alcesti -Fenomeni Franosi (Prof. Capponi)
Manuela Repetto
 
read to grafics of function
read to grafics of functionread to grafics of function
read to grafics of function
viktoriya71
 
Mau va bach huyet (anh) 1
Mau va bach huyet (anh) 1Mau va bach huyet (anh) 1
Mau va bach huyet (anh) 1
Pham Ngoc Quang
 

Andere mochten auch (20)

Durmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga DevamDurmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga Devam
 
GEOMETRY_ARHIMED
GEOMETRY_ARHIMEDGEOMETRY_ARHIMED
GEOMETRY_ARHIMED
 
E-portfolio interoperability and the advance of Leap2A
E-portfolio interoperability and the advance of Leap2AE-portfolio interoperability and the advance of Leap2A
E-portfolio interoperability and the advance of Leap2A
 
Frameworks of skill and competence: what, why, when, how?
Frameworks of skill and competence: what, why, when, how?Frameworks of skill and competence: what, why, when, how?
Frameworks of skill and competence: what, why, when, how?
 
Red House & West Gate
Red House & West GateRed House & West Gate
Red House & West Gate
 
Pres Blog Oct
Pres Blog OctPres Blog Oct
Pres Blog Oct
 
TANET - Nhung van de chung ve quan ly thue - 07.2010
TANET - Nhung van de chung ve quan ly thue -  07.2010TANET - Nhung van de chung ve quan ly thue -  07.2010
TANET - Nhung van de chung ve quan ly thue - 07.2010
 
Libertad de expresión
Libertad de expresiónLibertad de expresión
Libertad de expresión
 
Email Marketing That Works
Email Marketing That WorksEmail Marketing That Works
Email Marketing That Works
 
Blogging, Activism, and a Christian Worldview
Blogging, Activism, and a Christian Worldview Blogging, Activism, and a Christian Worldview
Blogging, Activism, and a Christian Worldview
 
The Sunset
The SunsetThe Sunset
The Sunset
 
Challenges of educational open data
Challenges of educational open dataChallenges of educational open data
Challenges of educational open data
 
GTX_Brand_BreatheSweeps_
GTX_Brand_BreatheSweeps_ GTX_Brand_BreatheSweeps_
GTX_Brand_BreatheSweeps_
 
Alcesti -Fenomeni Franosi (Prof. Capponi)
Alcesti -Fenomeni Franosi (Prof. Capponi)Alcesti -Fenomeni Franosi (Prof. Capponi)
Alcesti -Fenomeni Franosi (Prof. Capponi)
 
read to grafics of function
read to grafics of functionread to grafics of function
read to grafics of function
 
Nhap mon sinh hoc 2
Nhap mon sinh hoc 2Nhap mon sinh hoc 2
Nhap mon sinh hoc 2
 
Mau va bach huyet (anh) 1
Mau va bach huyet (anh) 1Mau va bach huyet (anh) 1
Mau va bach huyet (anh) 1
 
He tuan hoan p3
He tuan hoan p3He tuan hoan p3
He tuan hoan p3
 
What we talk about when we talk about ebooks
What we talk about when we talk about ebooksWhat we talk about when we talk about ebooks
What we talk about when we talk about ebooks
 
Chuong 8 than nhiet vtm
Chuong 8 than nhiet vtmChuong 8 than nhiet vtm
Chuong 8 than nhiet vtm
 

Ähnlich wie Evolution of API With Blogging

GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
David Calavera
 

Ähnlich wie Evolution of API With Blogging (20)

DevDays09 Internet Explorer 8
DevDays09 Internet Explorer 8DevDays09 Internet Explorer 8
DevDays09 Internet Explorer 8
 
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
 
YQL talk at OHD Jakarta
YQL talk at OHD JakartaYQL talk at OHD Jakarta
YQL talk at OHD Jakarta
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Forum Presentation
Forum PresentationForum Presentation
Forum Presentation
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
merb.intro
merb.intromerb.intro
merb.intro
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
 
Plagger the duct tape of internet
Plagger the duct tape of internetPlagger the duct tape of internet
Plagger the duct tape of internet
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
 
Putting SOAP to REST
Putting SOAP to RESTPutting SOAP to REST
Putting SOAP to REST
 
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Living in the Cloud: Hosting Data & Apps Using the Google InfrastructureLiving in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
 
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Living in the Cloud: Hosting Data & Apps Using the Google InfrastructureLiving in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
 
Why Python Web Frameworks Are Changing the Web
Why Python Web Frameworks Are Changing the WebWhy Python Web Frameworks Are Changing the Web
Why Python Web Frameworks Are Changing the Web
 
Fast Loading JavaScript
Fast Loading JavaScriptFast Loading JavaScript
Fast Loading JavaScript
 
Widgets Tools Keynote
Widgets Tools KeynoteWidgets Tools Keynote
Widgets Tools Keynote
 
Html5
Html5Html5
Html5
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Evolution of API With Blogging

  • 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. 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.
  • 5. Please don't throw a chair like Steve Ballmer or kazeburo!
  • 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.
  • 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
  • 9. Movable Type 10 th Anniversary!
  • 10. Let's talk about blogging API!
  • 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
  • 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
  • 13. 2001-2004 Movable Type was released in Oct 2001. By 2001, blogging community increased rapidly. http://en.wikipedia.org/wiki/History_of_blogging
  • 14. 2004
  • 15. 2011 YAPC::Asia Tokyo 2011 Evolution of API With Blogging
  • 16. “ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.” - Albert Einstein 温故知新 - 孔子 Why?
  • 18.  
  • 19.  
  • 20.  
  • 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);
  • 22.  
  • 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;
  • 24.  
  • 25.  
  • 26. Sample use Data::Dumper; use XML::Feed; my $uri = 'http://example.com'; my @urls = XML::Feed->find_feeds($uri); say Dumper(@urls);
  • 27.  
  • 28. use URI; use XML::FOAF; my $uri = URI->new('http://example.com'); my $foaf = XML::FOAF->new($uri); say $foaf->person->nick; Sample
  • 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; />
  • 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);
  • 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
  • 32.  
  • 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);
  • 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);
  • 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);
  • 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
  • 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>
  • 38.  
  • 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);
  • 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
  • 42.  
  • 44. PubSubHubbub Implementations Publisher http://pubsubhubbub.googlecode.com/svn/trunk/ Hub http://pubsubhubbub.appspot.com/ Subscriber ttp://d.hatena.ne.jp/tokuhirom/20100307/push
  • 45.  
  • 46.  
  • 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
  • 49. Anyway, Are you enjoying YAPC::Asia?
  • 50.  
  • 51.  
  • 52. This is very precious to me in YAPC::Asia Tokyo 2011! Did you have anything like this? You should talk with ROCK STARS!
  • 53. Okay, back to my talk
  • 55. JSON XML is still used as structured data/representation like HTML But response of API is moving to JSON.
  • 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
  • 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
  • 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/
  • 59. And Also ... REST (HTTP verbs, Resource, URI) Authentication (OAuth2) Rate Limiting
  • 60. And more... Performance Tips Using gzip Working with partial response http://code.google.com/apis/discovery/v1/performance.html
  • 61.
  • 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
  • 64. Import/Export Next Future? Camlistore is a way to store, sync, share, model and back up content http://camlistore.org/
  • 66. Blogging World Is Still Fun, Let's Hack Together!
  • 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
  • 68. Finally, I would like to introduce a module for you
  • 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/
  • 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'};
  • 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.
  • 72. I'll keep updating the module. And, if you are a programmer, also you can write some code. Right?
  • 74. I'm using USB- booted Ubuntu VOTE ME!