Post on 22-Jan-2018
Jan Vonka - London Meetup (March 2017)
Alfresco 5.2 REST APIs
Introduction
ImageCredit:HVonka
Introduction
Jan Vonka
• Senior Developer @ Alfresco
• Balloonist• flying balloons over cities takes a lot of planning J
• For background, see:
• http://www.slideshare.net/jvonka/alfresco-rest-api-of-the-future-is-closer-than-you-think
• https://www.youtube.com/watch?v=7jR2PV5w1O4ImageCredit:https://www.adventureballoons.co.uk
REST API Agenda
• Overview & Architecture• Documentation• What’s New & Changed ?• Demo• What’s Next ?• References
Overview & Architecture
ImageCredit:HVonka
Alfresco Digital Business Platform
Applications – Engaging UX - Mobile, Web, App Dev Framework, Desktop
Alfresco ProcessServices
Alfresco ContentServices
Alfresco Governance Services
Integrations / Extensions
Open APIs and Open Standards
On-Premise, Cloud, Hybrid, Managed
Intelligence and Analytics
Alfresco API Overview
ContentServices(Repository)
ProcessServices(Activiti)
RESTAPIRESTAPI
Alfre
scoPlatform
Micro-Services/Con
tainers
SearchServices
(Solr)
GovernanceServices(RM)
RM
ECMBPM
CMIS(BrowserBinding)
ADF
JavaScriptClientBinding
HTTPS/JSON/Binary
App App
JavaClientBinding(EA)
App App
OtherLibs/Fwks
RM
REST API components
REST API Introduction
• REST Framework – pragmatic, follows well-defined RESTful guidelines
• Open API– consistent, documented, functional, performant, secure, reliable …
• The API for all new clients– enabler for Alfresco Digital Business Platform
• Roles– End-User vs Administrators– permissions – Groups / Users
• CMIS is still a good option– eg. heterogeneous environments
URL Structure
https://host:port/alfresco/api/-default-/public/alfresco/versions/1/…
Scope APIName Version
Entity Relationship(orOperation**)
Tenant
/nodes/nodes/{id}/nodes/{id}/children/nodes/{id}/copy
* Where applicable** Operations are new for 5.2 (used for specific scenarios where relationship does not make sense)
GET, POSTGET, PUT, DELETEGET, POSTPOST
DeployedEnvironment
Method(*)
Documentation
ImageCredit:www.renishaw.com
API Docs
ImageCredit:http://www.commitstrip.com/en/2017/02/20/no-ones-fault/?
• Is your friend !• Single source of truth• Open API Spec (~ Swagger)• Generate client-side bindings• Developer resource
– http://api-explorer.alfresco.com– https://github.com/Alfresco/rest-
api-explorer– http://artificats.alfresco.com
• GAV: org.alfresco.api-explorer (5.2.e/5.2.0)
API Explorer
Example: Content Services Core API
ActivitiesCommentsFavoritesNetworksNodesPeoplePreferences
QueriesRatingsRenditionsShared-linksSitesTagsTrashcanVersions
Provides access to the core features of Alfresco Content Servicesto retrieve, manage and find entities such as:
https://community.alfresco.com/docs/DOC-6532-alfresco-52-rest-apis
Alfresco 5.2 REST APIs
• Cheat-sheet • Links to lots of resources
– Blogs– Videos– Presentations– Bindings– Sample clients– Docs
• Gavin Cornwell• Series has 8 parts so far
– more coming soon– includes Postman collections
Community Blog Post Series
https://community.alfresco.com/community/ecm/blog/2016/10/11/v1-rest-api-part-1-introduction
What’s New & Changed ?
ImageCredit:HVonka
What’s New
• 56 new endpoints!– Core API– Authentication API– Discovery API– Search API
• REST Framework enhancements– return less => fields query parameter– return more => include query parameter (API specific)– operations (eg. /copy, /move, /lock, /unlock, /revert, /restore, …)– @WebApiNoAuth
Upload contentcurl -utest:test –X POSThttp://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children -F filedata=@test.txt
Download contentcurl -utest:test -X GEThttp://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/99a40be1-268f-4b8e-ab49-866747bbd660/content
Simple Example
Core API
…/alfresco/api/-default-/public/alfresco/versions/1/…
• /nodes/{nodeId}– Navigation– Content– Information– Operations include: Copy, Move, Lock, Unlock– Associations
• /nodes/{nodeId}/renditions• /nodes/{nodeId}/versions
– Operations include: Revert
Core API
…/alfresco/api/-default-/public/alfresco/versions/1/…
• /deleted-nodes– Operations: Restore
• /queries– /nodes– /people– /sites
• /shared-links– public share, unshare, find, …– expiration (new)
Authentication API
…/alfresco/api/-default-/public/authentication/versions/1/…
• /tickets– Login– Logout– Validate
Discovery API
…/alfresco/api/…
• /discovery– Version information– License information (Enterprise only)– Status
• isReadOnly• isQuickSharedEnabled• …
– Installed modules
Search API
…/alfresco/api/-default-/public/search/versions/1/...
• /search– Low level search API (effectively exposes Java API)– AFTS, CMIS, Lucene support– Faceting– Spellcheck– Term highlighting– Search nodes, versions or deleted-nodes
Enhanced APIs
…/alfresco/api/-default-/public/alfresco/versions/1/…
• /sites– Create site (no custom preset support yet)– Update site details– Delete site
• /people– List people (no filtering)– Create person– Update person
• Enable/Disable (admin only)
Demo
ImageCredit:PressAssociation
Postman Collection
• File -> Import -> Import From Link
https://www.getpostman.com/collections/e28cf833734602fb4609
Simple File Sharing prototype (using new APIs)
Files&FoldersUpload&DownloadPreviewLiveSearchSharedLinksMove&CopyDelete& Undo….
Client Bindings & Example Apps
• Alfresco ADF (Application Development Framework)– JavaScript client-side– see: ADF 101 tutorial blogs– example: HealthCare Demo App
• Java Client SDKs (Early Access)– see: Java Client blogs– example: basis for new Android client(s)
• Developer Ecosystem … Partners & Community J
What’s Next ?
ImageCredit:www.timeout.com
Futures
• More Services exposed– Group Management– Download as Zip– …– Audit ?– Repository Actions ?
• Other Enhancements– more REST Framework improvements (eg. batch)– …– new features based on your (client-driven) feedback !
References
ImageCredit:HVonka
References
• Alfresco 5.2 REST APIs (with more links)https://community.alfresco.com/docs/DOC-6532-alfresco-52-rest-apis
• API Explorerhttps://api-explorer.alfresco.comhttps://github.com/Alfresco/rest-api-explorer
• Tech Talk Live #102 https://www.youtube.com/watch?v=cpSksoy-zkk
Thank You
JanVonkahttps://www.slideshare.net/jvonka