[webinar] an hour with the cto: all about apis and the nuxeo platform
DESCRIPTION
The Nuxeo Platform is based on a component architecture and extension points that allow you to extend and customize exposed services. The latest version of the platform (5.8) offers a set of resource-oriented REST APIs to support the development of content-centric applications. Learn what we did to create these new REST APIs and how you can use them in your own applications. Spend an hour with Nuxeo CTO, Thierry Delprat as he talks specifics of the Nuxeo REST APIs. During this live webinar Thierry will: Review the solutions used to make the REST APIs extensible and composable, Discuss the challenges associated with a dynamic API. When the REST API was designed, it was important to ensure it contained the same flexibility and richness available with the Java APIs. Be sure to join us to see exactly what we did to make this happen. If you want to get a head-start, download the REST API package from the Nuxeo Marketplace, or read through the Nuxeo REST API documentation.TRANSCRIPT
![Page 1: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/1.jpg)
NUXEO PLATFORM&
APIwhat is coming in the next releases ?
![Page 2: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/2.jpg)
NUXEO PLATFORMnot only a Content Repository
provide tools to build Content AppsConfiguration StudioAPI, SDK, Dev tools, Test toolsPackaging and deployment tools
![Page 3: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/3.jpg)
these 2 trends are driving the Roadmap for 5.9.x fastracks
BUILD MODERN WEB APPS
Back to the client sideHtml 5 / JavaScriptMobile Apps
Leverage Cloud promisesECM as a serviceEasy scaling
![Page 4: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/4.jpg)
APIIS THE MAIN ENTRY POINT
API is a major focus for next FastTrack releases
![Page 5: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/5.jpg)
NUXEO API CHALLENGESexpose Nuxeo Platform via http without losing our soul
![Page 6: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/6.jpg)
BEING DYNAMICServices to expose depends on deployment option
Contribute custom Services
Data Structures (users, docs ...) depends on configuration
+workflowService +conversionService -relationService
+myCustomBusinessService
{ common : {...}, dublincore : {...}, customSchema : {...}, ...}
![Page 7: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/7.jpg)
BEING COMPOSABLE"Pack" several services calls inside the same transaction
Fetch all required information in one call
aggregate all required info
updateDoc + validateTask + generatePDF
doc attributes + associated tasks + urls
![Page 8: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/8.jpg)
AND ALSOefficiently manage streams
manage authentication in an easy and pluggable way
be HTML/JavaScript friendly
byte[] ==> evilMultiPart ==> pain
new XMLHttpRequest()
![Page 9: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/9.jpg)
HOW WE BUILT THE AUTOMATION APIexpose a dynamic http API
![Page 10: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/10.jpg)
AUTOMATION REST ENDPOINTExpose Nuxeo entities as REST resources
Documents, Users, Workflows, Tasks ...
CRUD via GET, PUT, POST, DELETEGET /nuxeo/api/v1/path/<font color="#6aa84f">{path}</font> HTTP/1.1
GET /nuxeo/api/v1/id/<font color="#6aa84f">{uid}</font> HTTP/1.1
GET /nuxeo/api/v1/user/<font color="#6aa84f">{userName}</font> HTTP/1.1
GET /nuxeo/api/v1/group/<font color="#6aa84f">{groupId}</font> HTTP/1.1
![Page 11: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/11.jpg)
REST ENDPOINT : GET DOCUMENTGET /nuxeo/api/v1/path/default-domain/workspaces/WS/TestNote HTTP/1.1
HTTP/1.1 200 OKContent-Type: application/json
{ "entity-type": "document", "repository": "default", "uid": "6a3998e3-6890-45f5-9c19-b708814a9c1c", "path": "/default-domain/workspaces/WS/TestNote", "type": "Note", "state": "project", "versionLabel": "0.0", "isCheckedOut": true, "title": "TestNote", "lastModified": "2014-01-20T13:11:29.64Z", ...}
![Page 12: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/12.jpg)
AUTOMATION RPC : OPERATIONS ENDPOINTCoarse grained API on top of Java API
each services can contribute Operations
Expose endpoint for OperationsGET to retrieve definitionPOST to execute
![Page 13: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/13.jpg)
OPERATIONS ENDPOINTGET /nuxeo/site/automation/Document.PageProvider HTTP/1.1
HTTP/1.1 200 OKContent-Type: application/json
id":"Document.PageProvider", "label":"PageProvider", "description":"Perform a query ...", "signature":[ "void", "documents" ], "params":[ { "name":"page", "type":"integer", "required":false },{ "name":"query", "type":"string", "required":false, }, ... ]}
![Page 14: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/14.jpg)
OPERATIONS ENDPOINTPOST /nuxeo/site/automation/Document.PageProvider HTTP/1.1Content-Type: application/json+nxrequest{ "params" : { "query" : "select * from Note", "page" : 0 }}
HTTP/1.1 200 OKContent-Type: application/json{ "entity-type": "documents", "pageIndex": 0, "pageSize": 2, "pageCount": 2, "entries": [ { "entity-type": "document", "repository": "default", "uid": "3f76a415-ad73-4522-9450-d12af25b7fb4", ... }, { ...}, ... ]}
![Page 15: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/15.jpg)
DYNAMIC DATA STRUCTUREFetch all needed data in one call
![Page 16: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/16.jpg)
CONTROL MARSHALINGuse header to control what schemas should be sent
fetch the data needed on the client side and nothing more
X-NXDocumentProperties dublincore, common, file
GET /nuxeo/api/v1/path/default-domain/workspaces/WS/TestNote HTTP/1.1
<b>X-NXDocumentProperties note, files</b>
![Page 17: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/17.jpg)
CONTROL MARSHALING GET /nuxeo/api/v1/path/default-domain/workspaces/WS/TestNote HTTP/1.1<span style="font-family: monospace;"> <font color="#6aa84f">X-NXDocumentProperties note, files</font> </span>
HTTP/1.1 200 OKContent-Type: application/json{ "entity-type": "document", ... <font color="#6aa84f">"properties": { "note:mime_type": "text/x-web-markdown", "note:note": "##Hello", "files:files": [ { "file": { "name": "layout.png", "mime-type": "image/png", "length": "43627", "data": "files/6a3998e3-6890-45f5-9c19-b708814a9c1c" } } ] } ...</font>}
![Page 18: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/18.jpg)
FETCH EXTRA INFOuse RestContributor to fetch additional info (Mixins)
urls, breadcrumb info, comments, related documents ...
use header to tell server what info is neededX-NXContext-Category breadcrumb
GET /nuxeo/api/v1/path/default-domain/workspaces/WS/TestNote HTTP/1.1
X-NXContext-Category breadcrumb
![Page 19: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/19.jpg)
FETCH REST CONTRIBUTIONS GET /nuxeo/api/v1/path/default-domain/workspaces/WS/TestNote HTTP/1.1<span style="font-family: monospace;"> <font color="#6aa84f">X-NXContext-Category breadcrumb</font> </span>
HTTP/1.1 200 OKContent-Type: application/json{ "entity-type": "document", ... <font color="#6aa84f"> "contextParameters": { "breadcrumb": { "entity-type": "documents", "entries": [ { "entity-type": "document", "repository": "default", "path": "/default-domain", ... }, ... ] } }</font>}
![Page 20: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/20.jpg)
LEVERAGE ADAPTER SYSTEMcontribute custom logic
@WebAdapter(name = BOAdapter.NAME,type = "BOService", targetType = "Document")@Produces({ "application/json+nxentity"})public class BOAdapter extends DefaultAdapter {
expose as business object with custom marshalingGET /nuxeo/api/v1/path/domain/workspaces/WS/note/<font color="#6aa84f">@audit</font> HTTP/1.1
GET /nuxeo/api/v1/path/domain/workspaces/WS/note/<font color="#6aa84f">@bo/MyBO</font> HTTP/1.1
![Page 21: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/21.jpg)
FETCH AUDIT RECORDS VIA ADAPTERGET /nuxeo/api/v1/path/domain/workspaces/WS/note/<font color="#6aa84f">@audit</font> HTTP/1.1
HTTP/1.1 200 OKContent-Type: application/json{ "entity-type":"<font color="#6aa84f">logEntries</font>", ... "entries":[ { "entity-type":"<font color="#6aa84f">logEntry</font>", "principalName":"tdelprat", "docType":"Note", "eventId":"documentCreated", "repositoryId":"default", "eventDate":"2014-01-12T16:58:55.294+01:00", ... }, <span style="font-family: monospace;">...</span><span style="font-family: monospace;">}</span>
![Page 22: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/22.jpg)
COMPOSABLE APIExpose the API that matches your needs
![Page 23: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/23.jpg)
AUTOMATION CHAINSOperations have Input / Output and Arguments
Operations can be chained on the service sideone call , one transaction
doc => updateDoc =(doc)=> validateTask =(doc)=> generatePDF =(Blob)=>
Create new Operations via composition
![Page 24: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/24.jpg)
COMPOSE CHAINvia XML / via Drag&Drop
![Page 25: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/25.jpg)
OPERATIONS AND RESOURCESBridge Operations and Resource Endpoints
"pipe Operation or Chain" on resourcefetch resource => feed Operation or Chain
POST /nuxeo/api/v1/path/domain/workspaces/WS/note/<font color="#6aa84f">@op/Blob.ToPDF</font>
![Page 26: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/26.jpg)
OPERATIONS AND EXTENSIONSContribute new Operations via Extension Point
Contribute new Adapters via Extension Point
Compose Operations via Workflow
![Page 27: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/27.jpg)
DYNAMIC AND COMPOSABLE APICool, but what is the trade-off
![Page 28: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/28.jpg)
API IS MORE POWERFUL, BUT MORE COMPLEXData mapping needs to be dynamic
Calling dynamic endpoints is more complex than static API
endpoint.invoke("createDocument", {input: ... , params:...})
nuxeo.createDocument(path, name, type)
![Page 29: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/29.jpg)
SOLUTION : Provide introspection
methods and data types
Provide client lib provides some data mapping(document, blob)provides a high level simple API (createDocument, addComment ...) does some checks(validate method definition)
Java, Javascript, Python, Dart, Php, ObjectiveC ...
![Page 30: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/30.jpg)
MULE CLOUDHUB EXAMPLELeverage Java Lib service wrapper
Plug Mule DataSense with Nuxeo Types introspectionMule fetches datatypes from Nuxeo
Use invoke like pattern for dynamic Operationscannot dynamicaly build UI from Automation metadata
![Page 31: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/31.jpg)
DYNAMIC DATA MAPPING
![Page 32: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/32.jpg)
ROADMAP & NEXT STEPS when is it ready ?
![Page 33: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/33.jpg)
NEXT STEPS : APIAPI improvements are part of 5.9.x FastTrack releases
REST EndPointsRestContributors and changes in marshaling
SDK are in progressJavaScriptAngularDartiOsAndroid
Sample Apps and playground
![Page 34: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/34.jpg)
NEXT STEPS : CLOUDnuxeo.io : Nuxeo Platform as a ServiceCloud provisioning + API + online IDE
ScalingElastic Search integrationNoSQL backend
![Page 35: [Webinar] An Hour with the CTO: All About APIs and the Nuxeo Platform](https://reader033.vdocument.in/reader033/viewer/2022061217/54b538e74a79594f358b466f/html5/thumbnails/35.jpg)
Q&A ?