• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
A REST API for Content Management
 

A REST API for Content Management

on

  • 4,076 views

Baking semantic web access into non-geek services

Baking semantic web access into non-geek services

Statistics

Views

Total Views
4,076
Views on SlideShare
4,071
Embed Views
5

Actions

Likes
0
Downloads
22
Comments
0

1 Embed 5

http://www.slideshare.net 5

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

A REST API for Content Management A REST API for Content Management Presentation Transcript

  • A REST API for Content Management baking semantic web access into non-geek services
  • Stephen Howard Athens, Georgia [email_address] http://enterity.com
  • a presentation in 3 acts
  • a presentation in 3 acts what is renao?
  • a presentation in 3 acts what is renao? the renao API
  • a presentation in 3 acts what is renao? the renao API building a community
  • act 1 what is renao?
  • renao [ren- ah -oh], adj. what is renao? From Mandarin. Lierally " hot " but also includes "noisy," "making noise," and "stirring up trouble.” In China the term is a positive, implying " lively, festive, happy, noisy " - especially noisy! from In Other Words by Christopher J. Moore http://myrenao.com/what
  • renao [ren- ah -oh], n. A hosted content management service http://myrenao.com
  • content management what is renao?
  • content management what is renao?
  • design management what is renao?
  • design management what is renao?
  • flexible results what is renao?
  • three guiding principles what is renao?
  • three guiding principles what is renao? content has structure
  • three guiding principles what is renao? content has structure URLs are nouns
  • three guiding principles what is renao? content has structure URLs are nouns templates for many formats
  • 1: content has structure what is renao: 3 guiding principles
  • 1: content has structure what is renao: 3 guiding principles most organizations have collections of things (resources), physical or conceptual, that they want to publish online
  • 1: content has structure what is renao: 3 guiding principles most organizations have collections of things (resources), physical or conceptual, that they want to publish online these resources usually have a consistent set of structured or semi-structured information
  • 1: content has structure what is renao: 3 guiding principles most organizations have collections of things (resources), physical or conceptual, that they want to publish online these resources usually have a consistent set of structured or semi-structured information let them use these structures they’re already familiar with when adding content to their sites
  • 1: content has structure what is renao: 3 guiding principles most organizations have collections of things (resources), physical or conceptual, that they want to publish online these resources usually have a consistent set of structured or semi-structured information let them use these structures they’re already familiar with when adding content to their sites a better format for machines to understand than flat html pages.
  • 2: URL s are nouns what is renao: 3 guiding principles
  • 2: URL s are nouns what is renao: 3 guiding principles URL s can refer to a specific resource http://example.com/about_us http://example.com/blog/designing_an_api
  • 2: URL s are nouns what is renao: 3 guiding principles or a list of resources URL s can refer to a specific resource http://example.com/Articles http://example.com/about_us http://example.com/blog/designing_an_api
  • 2: URL s are nouns what is renao: 3 guiding principles use query parameters to refine your results or a list of resources URL s can refer to a specific resource /Articles?name[like]=perl&sort=publish_date,desc http://example.com/Articles http://example.com/about_us http://example.com/blog/designing_an_api
  • 2: URL s are nouns what is renao: 3 guiding principles or use the full-text search parameter instead http://example.com?q=perl http://example.com/blog?q=perl use query parameters to refine your results or a list of resources URL s can refer to a specific resource /Articles?name[like]=perl&sort=publish_date,desc http://example.com/Articles http://example.com/about_us http://example.com/blog/designing_an_api
  • 2: URL s are nouns what is renao: 3 guiding principles or use the full-text search parameter instead http://example.com?q=perl http://example.com/blog?q=perl special shortcut URL s for tags use query parameters to refine your results or a list of resources URL s can refer to a specific resource http://example.com/Articles/t/perl http://example.com/blog/t/perl /Articles?name[like]=perl&sort=publish_date,desc http://example.com/Articles http://example.com/about_us http://example.com/blog/designing_an_api
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request:
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request: /article.html what kind of resource is it?
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request: /resource.html can’t find a template for that resource type? look for a template for the parent resource type. /article.html what kind of resource is it?
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request: /articles.html is the request for a list of resources? /resource.html can’t find a template for that resource type? look for a template for the parent resource type. /article.html what kind of resource is it?
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request: check for template / blog/article.html otherwise use /article.html what collection is the resource in? /articles.html is the request for a list of resources? /resource.html can’t find a template for that resource type? look for a template for the parent resource type. /article.html what kind of resource is it?
  • 3: templates for many formats what is renao: 3 guiding principles how renao picks from your templates for a given request: ends in .xml? -> use /article.xml is there a specific extension on the url? check for template / blog/article.html otherwise use /article.html what collection is the resource in? /articles.html is the request for a list of resources? /resource.html can’t find a template for that resource type? look for a template for the parent resource type. /article.html what kind of resource is it?
  • a presentation in 3 acts what is renao? the renao API building a community
  • act 2 the renao API
  • API objectives the renao API
  • API objectives the renao API access your own site
  • API objectives the renao API access your own site write software for others to use
  • API objectives the renao API access your own site write software for others to use your site is your API, no special urls
  • API objectives the renao API access your own site write software for others to use your site is your API, no special urls manage content and design
  • API objectives the renao API access your own site write software for others to use your site is your API, no special urls manage content and design single authentication scheme
  • 1: access your own site the renao API: objectives
  • 1: access your own site the renao API: objectives update your site to reflect activities around the web
  • 1: access your own site the renao API: objectives update your site to reflect activities around the web update other sites and services to reflect changes on your site
  • 1: access your own site the renao API: objectives update your site to reflect activities around the web update other sites and services to reflect changes on your site integrate with your own software projects
  • 1: access your own site the renao API: objectives update your site to reflect activities around the web update other sites and services to reflect changes on your site integrate with your own software projects tools and shortcuts that better match how you work.
  • 2: write software for others the renao API: objectives
  • 2: write software for others the renao API: objectives integrate Renao into existing software
  • 2: write software for others the renao API: objectives integrate Renao into existing software create convenience tools
  • 2: write software for others the renao API: objectives integrate Renao into existing software create convenience tools bookmarklets
  • 2: write software for others the renao API: objectives integrate Renao into existing software create convenience tools bookmarklets browser plugins
  • 2: write software for others the renao API: objectives integrate Renao into existing software create convenience tools bookmarklets browser plugins desktop apps
  • 2: write software for others the renao API: objectives integrate Renao into existing software create convenience tools bookmarklets browser plugins desktop apps start a business
  • 3: your site is your API the renao API: objectives
  • 3: your site is your API the renao API: objectives Minimize the amount of extra code to support an API
  • 3: your site is your API the renao API: objectives Minimize the amount of extra code to support an API Minimize the number of API-specific urls
  • 3: your site is your API the renao API: objectives Minimize the amount of extra code to support an API Minimize the number of API-specific urls Use REST so talking to API users is nearly the same as talking to site visitors
  • 4: manage content and design the renao API: objectives
  • 4: manage content and design the renao API: objectives provide alternative interfaces for site owners
  • 4: manage content and design the renao API: objectives provide alternative interfaces for site owners desktop apps for richer design file editing
  • 4: manage content and design the renao API: objectives
    • provide alternative interfaces for site owners
    • desktop apps for richer design file editing
      • image editors
  • 4: manage content and design the renao API: objectives
    • provide alternative interfaces for site owners
    • desktop apps for richer design file editing
      • image editors
      • syntax highlighters
  • 4: manage content and design the renao API: objectives
    • provide alternative interfaces for site owners
    • desktop apps for richer design file editing
      • image editors
      • syntax highlighters
      • file upload progress indicators
  • 4: manage content and design the renao API: objectives
    • provide alternative interfaces for site owners
    • desktop apps for richer design file editing
      • image editors
      • syntax highlighters
      • file upload progress indicators
    • implement features I wouldn’t think of, don’t have time for, or don’t want
  • 4: manage content and design the renao API: objectives Caveat managing design files will probably violate the “no special urls” API rule.
  • 4: manage content and design the renao API: objectives
    • Caveat
    • managing design files will probably violate the “no special urls” API rule.
    • normal graphics, scripts and css directories should be:
      • fast:
      • no permission checks
      • minimal server side scripting
      • potentially:
      • distributable across a CDN
  • 5: single authentication scheme the renao API: objectives
  • 5: single authentication scheme the renao API: objectives OAuth
  • 5: single authentication scheme the renao API: objectives OAuth 3-legged provide access on behalf of another user never have to ask for or store the user’s username and password User grants you an access-token which they have the power to revoke at a later date
  • 5: single authentication scheme the renao API: objectives OAuth 2-legged skip access-token dance send token-less OAuth requests for resources on your own sites 3-legged provide access on behalf of another user never have to ask for or store the user’s username and password User grants you an access-token which they have the power to revoke at a later date
  • single authentication scheme the renao API: objectives http://oauth.net/core/1.0
  • integrating the API the renao API session cleanup PerlCleanupHandler logging PerlLogHandler code written with REST in mind the main event PerlResponseHandler cookies or OAuth? initialize session PerlAccessHandler map url to resource(s) PerlTransHandler request_method browser fix-up map domain to site and account PerlInitHandler for API compatibility for all requests apache request cycle
  • using the renao API the renao API
  • using the renao API actions are HTTP Requests the renao API
  • using the renao API actions are HTTP Requests GET, HEAD, PUT, POST, DELETE the renao API
  • using the renao API actions are HTTP Requests GET, HEAD, PUT, POST, DELETE act on the URLs on your site the renao API
  • using the renao API actions are HTTP Requests GET, HEAD, PUT, POST, DELETE act on the URLs on your site OAuth for tasks that require authorization the renao API
  • using the renao API actions are HTTP Requests GET, HEAD, PUT, POST, DELETE act on the URLs on your site OAuth for tasks that require authorization account with developer key and passcode the renao API
  • sometimes you can get stuff done without authenticating the renao API: examples <h3> <a href= &quot;http://myrenao.com/discuss&quot; class= &quot;recent_topics&quot; > Recent Community Discussion Topics </a> <img src= &quot;/graphics/icons/go.png&quot; alt= &quot;go&quot; /> </h3> <h3> <a href= &quot; http://enterity.myrenao.com/blog &quot; class= &quot;recent_topics&quot; > Recent Blog Posts </a> <img src= &quot;/graphics/icons/go.png&quot; alt= &quot;go&quot; /> </h3> (1 of 3)
  • sometimes you can get stuff done without authenticating the renao API: examples // JSONP request with jQuery ----------------- Widget.RecentTopics = function( link ) { var baseurl_regex = new RegExp ( &quot;(http://[^/]+)&quot; ); var baseurl = link .href. match (baseurl_regex)[ 0 ]; $. getJSON ( link .href + '.jsonp?jsoncallback=?' , function( resources ){ for( var i = 0 ; i < resources .length; i ++ ) { var name = resources [i].subject || resources [i].name; $( link ). parent ().after( '<h4><a href=&quot;' + baseurl + resources [ i ].uri+ '&quot;>' + name + '</a></h4>’ ); } }) } // hook into the html ----------------- $ (function(){ $ ( 'a.recent_topics' ). each (function(){ Widget.RecentTopics ( this ); }); }); (2 of 3)
  • sometimes you can get stuff done without authenticating the renao API: examples [% # template: collection.jsonp ---- cgi . param ( 'jsoncallback' ); ‘(‘ ; # get the 10 most recent resources from this collection ---- USE Resources ; resources = Resources . retrieve ( 'Resource' , { inclusive => 1 , range => { offset => 0 , limit => 10 }, sort => [ 'publish_date' , 'desc' ], conditions => [ 'in' , 'collections' , collection .id] }); # output each resource in json format ---- FOREACH resource = resources ; PROCESS resource.json ; ',' UNLESS loop . last ; END; %] ) (3 of 3)
  • using Perl and Net::OAuth the renao API: examples use Net::OAuth ; use LWP::UserAgent ; use HTTP::Request::Common ; use Digest::MD5 qw( md5_hex ); my $site = 'stephen.myrenao.com' ; my $url = '/blog/Articles.json'; my $oauth_consumer_key = '848b9908df07dcdcb' ; my $oauth_consumer_secret = '7aeaded3671776407' ; # create OAuth Signature ----------------- my $oauth = Net::OAuth -> request ( 'consumer' )-> new ( request_url => $url , request_method => 'POST' , consumer_key => $oauth_consumer_key , consumer_secret => $oauth_consumer_secret , signature_method => 'HMAC-SHA1' , timestamp => time , nonce => md5_hex ( $oauth_consumer_key , time ), ); $oauth -> sign ; (1 of 2)
  • using Perl and Net::OAuth the renao API: examples # make HTTP Request ----------------- my $response = LWP::UserAgent -> new -> request ( POST &quot;http:// $site$url &quot; , Authorization => $oauth -> to_authorization_header , Content => { alias => 'testing_oauth' , name => 'testing my api' , body => 'This is a test of the Renao API' , commentable => 1 } ); # handle HTTP Response ----------------- print $response -> is_success ? &quot;successfully posted to site &quot; : &quot;something went wrong ” ; print $response -> status_line . &quot; ” . $response -> decoded_content . &quot; &quot; ; (2 of 2)
  • future API plans the renao API
  • future API plans the renao API accept data in more formats
  • future API plans the renao API accept data in more formats use headers to determine default response format
  • future API plans the renao API accept data in more formats use headers to determine default response format add device/screen-size detection for template selection
  • 1: accept data in more formats the renao API: future plans Check the content-type header on requests and parse body appropriately.
  • 1: accept data in more formats the renao API: future plans
    • Check the content-type header on requests and parse body appropriately. At least support:
      • application/x-www-form-urlencoded
      • multipart/form-data
      • application/json
      • text/xml
  • 2: use headers to determine default response format No format extension on the url? Use HTTP Accept header to determine response format the renao API: future plans http://example.com/about_us
  • 3: device/screen-size detection the renao API: future plans
  • 3: device/screen-size detection the renao API: future plans All devices use the same urls and domains
  • 3: device/screen-size detection the renao API: future plans All devices use the same urls and domains Use HTTP User-Agent header to look up templates particular for the device or class of device
  • 3: device/screen-size detection the renao API: future plans All devices use the same urls and domains Use HTTP User-Agent header to look up templates particular for the device or class of device Eliminates the need to maintain multiple copies or interfaces to your content for different devices
  • a presentation in 3 acts what is renao? the renao API building a community
  • act 3 building a community
  • examples building a community mashups Google Maps themes plugins Wordpress web apps desktop clients twitter desktop photo app integration web mashups extended services (printing) flickr
  • why build a community? building a community
  • why build a community? power users (designers and developers) can amplify and spread your work building a community
  • why build a community? power users (designers and developers) can amplify and spread your work service users can help each other out to excel at using the service to accomplish their goals building a community
  • why build a community? power users (designers and developers) can amplify and spread your work service users can help each other out to excel at using the service to accomplish their goals provides a group of people passionate about the service that won’t hesitate to provide an ongoing reality-check to you building a community
  • “ create more value than you capture” - Tim O’Reilly building a community
  • how to attract a community? some ideas building a community
  • how to attract a community? some ideas provide an online venue for the community to gather building a community
  • how to attract a community? some ideas provide an online venue for the community to gather cultivate an atmosphere of helpfulness among service users building a community
  • how to attract a community? some ideas provide an online venue for the community to gather cultivate an atmosphere of helpfulness among service users affiliate program building a community
  • how to attract a community? some ideas provide an online venue for the community to gather cultivate an atmosphere of helpfulness among service users affiliate program provide features that will attract power users building a community
  • features for power users ideas for designers building a community
  • features for power users ideas for designers allow for complete design flexibility building a community
  • features for power users ideas for designers allow for complete design flexibility user-contributed themes gallery building a community
  • features for power users ideas for designers allow for complete design flexibility user-contributed themes gallery free “project starter” sites for new client sites building a community
  • features for power users ideas for developers building a community
  • features for power users ideas for developers an API that is easy to understand and write for building a community
  • features for power users ideas for developers an API that is easy to understand and write for good API documentation building a community
  • features for power users ideas for developers an API that is easy to understand and write for good API documentation low barriers to getting started building a community
  • a presentation in 3 acts what is renao? the renao API building a community fin.
  • Thanks http://myrenao.com [email_address]
  • discussion: how do you attract a community around a service? http://myrenao.com [email_address]