Reusing website content in Web or mobile applications is a common developer challenge. Join this webinar to find out how to integrate Magnolia CMS with external frameworks using an HTTP API and create new content-driven applications.
This webinar will be most useful to CMS and Rails developers as well as system integrators. Join us with special guest presenters Patrik Metzmacher and Daniel Trierweiler from German digital advertising agency, Dievision.
Find out how to use Magnolia CMS content in third-party applications while still preserving Magnolia's WYSIWYG editing experience for content authors. It will demonstrate how to create a custom API to access Magnolia CMS content from a Rails project, and highlight common challenges and best practices for the integration.
7. @MAGNOLIA_CMS 7
We need to provide a
first-class CMS to our clients.
We want to have freedom in the
choice of our application
development environment.
12. @MAGNOLIA_CMS 12
The Problem:
Using Content in an(y) Application
The Solution, Magnolia Part:
REST Server and UI Integration
The Solution,
(Rails-) Application Part:
REST Client and Application Integration
15. @MAGNOLIA_CMS 15
Integrates with a different process
All content-related work should
be done within Magnolia CMS
(Almost) all development should
take place outside of Magnolia
CMS
20. @MAGNOLIA_CMS 20
Use Case Example
Use content in an external
application
Add content to a web shop
Provide a consistent content
creation experience among
multiple websites
Add content to a web shop
Develop application-driven and
content-driven sites
in a consistent way
Same tech stack and increased
efficiency for a dev team over
multiple projects
Decouple components of
an application –
e.g. to gain development and
deployment flexibility
Mobile application that re-uses
existing content in a different
way
27. @MAGNOLIA_CMS 27
Magnolia Module
Plain Java, no Ruby dependencies
Jersey/JAX-RS JSON REST API
(does not use the Magnolia 5.2 REST framework for historical
reasons)
Exposes content, CMS functionality
Proxies requests from the Pages
App
to the external application
33. @MAGNOLIA_CMS 33
curl --user superuser:superuser
'http://localhost:8080/sinicum-rest/website/de?pretty=true'
{
"meta" : {
// JCR/Magnolia meta information on a node
},
"properties" : {
// The node’s properties
},
"nodes" : {
!
// The child nodes relevant for the document
"child_node" : {
"meta" : {
// JCR/Magnolia meta information on the child node
},
"properties" : {
// The child node’s properties
},
!
!
!
}
}
}
34. @MAGNOLIA_CMS 34
curl --user superuser:superuser
'http://localhost:8080/sinicum-rest/website/de?pretty=true'
{
"meta" : {
// JCR/Magnolia meta information on a node
},
"properties" : {
// The node’s properties
},
"nodes" : {
!
// The child nodes relevant for the document
"child_node" : {
"meta" : {
// JCR/Magnolia meta information on the child node
},
"properties" : {
// The child node’s properties
},
"nodes" : {
// All relevant nodes are resolved recursively
}
}
}
}
35. @MAGNOLIA_CMS 35
„Documents“, not JCR Nodes
Returns a Node including its
relevant children in a single
request
(e.g. Page + Area + Components)
Optionally, UUID References
are resolved as well
37. @MAGNOLIA_CMS 37
Get a single node (and it’s children) via its path
GET /sinicum-server/:workspace/:path
Get a single node (and it’s children) via its UUID
GET /sinicum-server/:workspace/_uuid/:uuid
Perform a JCR query
GET /sinicum-server/:workspace/_query
Parameter Name Description
query The JCR query to perform
language The JCR query language (xpath, sql, jcr_sql2)
limit The maximum number of results
offset The offset for the results
38. @MAGNOLIA_CMS 38
Get all valid components for an area
GET /sinicum-server/_templating/components/
:module_name/:page_name/:area_name
Create and initialize an Area on a Page
POST /sinicum-server/_templating/areas/initialize
Parameter Name Description
workspace The name of the workspace
baseNodeUuid The UUID of the node to create the Area in
areaName The name of the Area to create
Get the dialog for a component
GET /sinicum-server/_templating/dialogs/
:component_type/:module_name/:component_name
41. @MAGNOLIA_CMS 41
% rails server
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-03-24 18:10:25] INFO WEBrick 1.3.1
[2014-03-24 18:10:25] INFO ruby 2.1.1 (2014-02-24) [x86_64-darwin12.4.0]
[2014-03-24 18:10:25] INFO WEBrick::HTTPServer#start: pid=68886 port=3000
45. @MAGNOLIA_CMS 45
Ruby client for the REST API
“Object-Document-Mapper” mapping
the JSON responses to Ruby objects that follow
Ruby/ActiveRecord semantics
Conventions for Template/Area/Component
files
Implementation of Magnolia CMS’
Tag Libraries as Rails Helpers
Convenience functionality to let Rails
Controllers handle requests to Magnolia CMS
47. @MAGNOLIA_CMS 47
Stable and used in production
Follows Dievision’s conventions
and can only benefit from
exposure to the outside world
48. @MAGNOLIA_CMS 48
We are happy to help you get
started:
sinicum@dievision.de
Follow the project at
github.com/dievision/sinicum
github.com/dievision/sinicum-
server
Fork it, create Issues and send