Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to the Alfresco Public API

3,375 views

Published on

This presentation gives a brief intro to the Alfresco Public API.

Published in: Technology
  • Be the first to comment

Intro to the Alfresco Public API

  1. 1. Intro to the Alfresco PublicAPIJeff PottsChief Community Officer
  2. 2. Doesn’t Alfresco already havean API?Yes, but…• Not really public (things change)• Not versioned• Not well documented• Doesn’t work for cloudThe Alfresco Public API addresses theselimitationsVision is to have a single API that worksacross cloud and on-premise
  3. 3. API Launch Partners
  4. 4. Folder, file, contentand metadatamanipulation andsearchNetworks, sites,people, comments,tags, activities, …
  5. 5. Getting Started1. Understand OAuth22. Register your app3. Grab a client-side CMIS library• Or an SDK if coding a mobile app4. Start coding!
  6. 6. Step 1: Groking OAuth2Defined in RFC-6749Secure authentication• 3rd party apps don’t ever see the user’spasswordUnambiguously identifies:• API provider (e.g. Alfresco)• Client application (e.g. your application)• End-user (e.g. an Alfresco Cloud user)
  7. 7. OAuth2 & AlfrescoUsed to secure the Alfresco APIOnly authentication mechanism provided forAPIs in Alfresco Cloud
  8. 8. Registering an AppApplicationDeveloperAlfrescoDeveloper PortalCreates developerprofileAssigns an API keyand secret for thatappSigns up ondeveloper portalRegisters anapplication
  9. 9. AuthorizationApplication Alfresco End-UserLinks to Alfrescoauthorization page,passing API key &secretAsks the user toauthorize the appUser authorizes theapp to access theiraccountRedirects to yourapp’s callbackURL, passingauthorization codeExchanges theauthorization codefor an access tokenReturns access andrefresh tokensSecurely persiststhe access andrefresh token forthat user
  10. 10. Making API CallsCalls APIs, passingthe access token inthe AuthorizationHTTP headerIdentifies user fromaccess token,executes API callApplication Alfresco
  11. 11. Refresh FlowCalls APIs, passingthe access token inthe AuthorizationHTTP headerReturns 401 error,indicating accesstoken has expiredRefreshes accesstoken, passingrefresh tokenReturns new accesstokenApplication Alfresco
  12. 12. OAuth2 library can hidedetailsSpring Socialhttp://www.springsource.org/spring-socialGoogle OAuth2 Clienthttps://developers.google.com/accounts/docs/OAuth2#libraries
  13. 13. Step 2: Register Your Apphttp://www.alfresco.com/develop• Alfresco Cloud Account• Registered Developer AccountAdd as many applications as you wantKey, secret, callback URL
  14. 14. Step 3: CMIS LibraryApache Chemistry is the umbrella project forall CMIS related projects at the ASF• OpenCMIS (Java, client and server)• cmislib (Python, client)• phpclient (PHP, client)• DotCMIS (.NET, client)• ObjectiveCMIS (Objective-C)Other client libraries exist
  15. 15. REST clienthttp://youtu.be/5QS0CNsPJEY
  16. 16. Create, Find, & Commenthttp://youtu.be/1ZtmoPdCKJI
  17. 17. Alfresco API URLsStructure:• Tenant• API scope• API name• API version• Entity typehttps://api.alfresco.com/* The notion of entity types doesn’t apply to CMIS.*public/acme.com/ sitesalfresco/versions/1/
  18. 18. Entity type collectionsThe entity type URL represents a collectionof all instances of that entity• The collection may or may not beretrievable via a GETEach instance of an entity can be accessedvia the collection URL with an Id appended.../acme.com/public/alfresco/versions/1/sites/mullet-gallery
  19. 19. Top level entity typessitespeopletagsnodesfavorites
  20. 20. Nesting entity typesEntity types may also be nestedThe same rule about retrieving instances byId applies.../acme.com/public/alfresco/versions/1/sites/mullet-gallery/members.../acme.com/public/alfresco/versions/1/sites/mullet-gallery/members/pmonks@alfresco.com
  21. 21. Create, update, & deleteCreating a new entity instance:• POST to the collection URLUpdating an entity instance:• PUT to the instance URLDeleting an entity instance:• DELETE against the instance URLThese rules apply regardless of whether it’sa top-level or nested collection
  22. 22. ConsiderationsRate limits• 5 requests/second, 10,000 requests/day (Dev)• 50 requests/second, 100,000 requests/day (Prod)No limit on # of applicationsAlfresco Cloud users own their content>= OpenCMIS 0.8.0-SNAPSHOT>= cmislib 0.5.1dev
  23. 23. RoadmapMerge APIs into Alfresco Enterprise v4.2New API types:• User Provisioning (SCIM)• Workflow (Activiti)New API versions:• CMIS v1.1• Alfresco v2 (?)New Alfresco API entity types:• renditions• bulk-imports (?)
  24. 24. RoadmapBinary property supportProjection & transclusion improvements(“SELECT”)Restriction improvements (“WHERE”)Discoverability improvements• In support of “executable documentation”
  25. 25. Getting HelpDocs: http://www.alfresco.com/developResources:• Alfresco API forum• #alfresco on freenode IRC• Alfresco Technical Discussion Google GroupSource Code:• Code from DevCon Session• Spring Social Alfresco Library• Peter’s Grails Example• Jeff’s Java Examples & Python Examples
  26. 26. Read the book!Everything you need toknow about CMIS1.0 & 1.1Lots of Groovy andJava examplesAlso covers Python,Android, & iOSNow on MEAP!37%-off: 12cmisal
  27. 27. The keys to one badass ECM platform are yours forthe takinghttp://www.alfresco.com/develophttp://www.flickr.com/photos/ph-stop/3101407532/

×