alfresco tech talk live - rest api of the future

32
REST API of the Future Tech Talk Live 6 th January 2016 Gavin Cornwell (@gcornwell), Engineering Manager

Upload: gavin-cornwell

Post on 22-Jan-2017

419 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Alfresco Tech Talk Live - REST API of the Future

REST API of the FutureTech Talk Live

6th January 2016Gavin Cornwell (@gcornwell), Engineering Manager

Page 2: Alfresco Tech Talk Live - REST API of the Future

Agenda• Introduction• Past• Present• Future• Demo• Questions

Agenda

Page 3: Alfresco Tech Talk Live - REST API of the Future

Introduction

Page 4: Alfresco Tech Talk Live - REST API of the Future

Why?• REST API space moving at an incredible rate, lots of stories

every week• Surge in mobile devices drove API usage

• Twitter have billions of API calls per day!• Everything has an API

– Apps, IoT, SmartTVs, Cars!• “X”aaS

• Main entry point is REST API• Extension point; no in-process access

• Treated as a product not a feature

Introduction

Page 5: Alfresco Tech Talk Live - REST API of the Future

Community• Open API Initiative (OAI)

– Google, Microsoft, IBM, 3Scale, Apigee, Restlet et al.– Linux Foundation– https://openapis.org– Swagger -> OpenAPI Specification as from 1st Jan

• Open APIs– http://apicommons.org (metadata/patterns)– http://apis.io (registry)

• Open Data– Even Government data

Introduction

Page 6: Alfresco Tech Talk Live - REST API of the Future

Tooling• Lots of tools emerging (new one every week)

• Numerous REST clients• Amazon API Gateway• SwaggerHub• Restlet APISpark• Can do some really cool stuff!

• http://restlet.com/blog/2015/10/28/real-time-stock-quotes-from-google-finance-with-apispark/

Introduction

Page 7: Alfresco Tech Talk Live - REST API of the Future

Past

Page 8: Alfresco Tech Talk Live - REST API of the Future

Past• Web Services (SOAP/WSDL)• CMIS• Webscript framework introduced• REST APIs started emerging

• Organically grew• Inconsistent URLs, parameters & responses (JSON & XML)• What’s public, what’s private?• Not very RESTful

Past

Page 9: Alfresco Tech Talk Live - REST API of the Future

Present

Page 10: Alfresco Tech Talk Live - REST API of the Future

Present• Public API Framework (4.2)

• Built on top of webscript engine• Set of internal RESTful guidelines• Consistent URLs, parameters & responses• Proper use of HTTP status codes

• On-Premise and Cloud support• /alfresco/api/-default-/public/alfresco/versions/1

• Ticket and Basic Auth• api.alfresco.com/{network}/public/alfresco/versions/1

• OAuth only

Present

Page 11: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Page 12: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Tenant

Page 13: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

ScopeTenant

Page 14: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Scope API NameTenant

Page 15: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Scope API Name VersionTenant

Page 16: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Scope API Name Version EntityTenant

Page 17: Alfresco Tech Talk Live - REST API of the Future

URL Structure

…/-default-/public/alfresco/versions/1/sites/{id}/members

Present

Scope API Name Version Entity RelationshipTenant

Page 18: Alfresco Tech Talk Live - REST API of the Future

URL Examples

• …/-default-/public/alfresco/versions/1/sites• …/-default-/public/workflow/versions/1/processes• …/-default-/public/cmis/versions/1.1/atom• …/-default-/private/alfresco/versions/1/cmm• …/-default-/extension/my-company/versions/1/my-entity

Present

Page 19: Alfresco Tech Talk Live - REST API of the Future

Entities• Nodes• Sites• People• Tags• Workflow• Networks (Cloud)

Present

Page 20: Alfresco Tech Talk Live - REST API of the Future

Confusion• REST API; which one?

– /service/api– CMIS– Alfresco One API

• Anyone know what this is?• 5.1 addressing this

– v0 REST API– v1 REST API– CMIS API

Present

Page 21: Alfresco Tech Talk Live - REST API of the Future

v0 v1 URL Comparison• GET /service/api/sites?size=5

• No paging info in response!• GET /service/api/node/{noderef}/children?skipCount=0&maxItems=5

– Actually maps to CMIS Atom XML!• POST /service/api/upload

• GET /api/-default-/public/alfresco/versions/1/sites?maxItems=5• GET

/api/-default-/public/alfresco/versions/1/nodes/{nodeId}/children?maxItems=5

• POST /api/-default-/public/alfresco/versions/1/nodes/{nodeId}

Present

Page 22: Alfresco Tech Talk Live - REST API of the Future

5.1 Enhancements• Stronger, clearer API support policy• v0 REST API moved to limited support• Backwards Compatibility Kit (BCK)• Documentation overhaul

• http://docs.alfresco.com/5.1/concepts/welcome.html (EA)

Present

Page 23: Alfresco Tech Talk Live - REST API of the Future

Future

Page 24: Alfresco Tech Talk Live - REST API of the Future

The following slides show roadmap information, it is not a commitment to implement those features and the information presented is subject to change.

Future

Page 25: Alfresco Tech Talk Live - REST API of the Future

Working On Now• v1 API investment

• Node Entity (File/Folder) (Demo shortly)• Enhancing REST API framework• API Definition (think WSDL)

• Swagger (Demo shortly)• API Explorer

• Swagger UI initially• Modularisation• Discoverability

Future

Page 26: Alfresco Tech Talk Live - REST API of the Future

Future Considerations• Functional equivalence to v0 REST API• Client Libraries

• Mobile (Android & iOS) already available• Java, JavaScript• Others generated from API definition

• Contract-first design– Developers and technical authors– Generate boiler plate code for server & client– Community via pull requests

Future

Page 27: Alfresco Tech Talk Live - REST API of the Future

Future Considerations• Monitor standards

– HATEOAS• Hypermedia As The Engine Of Application State• Roy Fielding; Level 3• HAL, Siren, JSON-LD, Collection+JSON etc.• CMIS Atom; kind of!

– OAI (Swagger/OpenAPI Specification)– RAML (now 1.0), API Blueprint (now open source)– oData

• Webhooks• Server Sent Events• Web Sockets

Future

Page 28: Alfresco Tech Talk Live - REST API of the Future

Future Considerations• API Management

• Design• Deploy• Keys/Authentication• Metrics• Monitoring• Integration with 3rd party tools

Future

Page 29: Alfresco Tech Talk Live - REST API of the Future

Demo

Page 30: Alfresco Tech Talk Live - REST API of the Future

Demo• File/Folder API• Swagger Definition & UI

Demo

Page 31: Alfresco Tech Talk Live - REST API of the Future

Feedback Welcome

@olehejlskov ([email protected])@gcornwell ([email protected])

Page 32: Alfresco Tech Talk Live - REST API of the Future

Questions?