You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 36 Next »

This page is intended for developers which want to start using the Magnolia REST features. We will show how to setup Magnolia in order to use all the REST functions provided by Magnolia. We quickly explain the available REST endpoints. And we give you an idea how you can test and use these endpoints.


Short version - all in 10' 

This section is a brief summary of the most important things from the sections below. Here we will not go into details but mention the most important points. 

Setup

We assume you are using Magnolia bundle with version 5.6 or higher and you know how you can:

  • Install Magnolia
  • Set the magnolia.resources.dir property in the magnolia.properties file.
  • Start and stop Magnolia.

We recommend to have one common directory for the magnolia.resources.dir on both webapps magnoliaAuthor and magnoliaPublic. We will use that later on for a shared configuration.

If you are unsure how to to set a common path for the magnolia.resources.dir, please refer to the beginners tutorial Hello Magnolia, or use Magnolia CLI - jumpstart

Required modules

These three modules listed below are required to use all Magnolia REST features within a productive context. 

  • magnolia-rest-integration
  • magnolia-rest-services
  • magnolia-rest-content-delivery

When using a preconfigured preconfigured Magnolia bundle - your webapp(s) already contain(s) these three modules. When using a custom webapp or bundle, make sure your custom setup contains the  module listed above. See REST module - Installing if you need help to install the Magnolia REST modules.

While developing new features, it can be helpful to use the magnolia-rest-tools which enable the swagger UI tools. Have a look at enabling swagger UI tools.

Enabling swagger UI tools - magnolia-rest-tools

The Swagger framework is supported by a set of core tools for designing, building, and documenting RESTful APIs.

Source: https://swagger.io/tools/

Magnolia provides integration with Swagger tools directly in the Admin UI.

Swagger tools are for development and testing purposes only.

If you do not want to usw the swagger tools- skip the next sections and proceed with reading about Getting started with Magnolia REST.

Installing the magnolia-rest-tools module

To enable swagger you must add magnolia-rest-tools to your webapp(s). 

With Maven

add the folowwing snippet to the pom file of your webapp:

Error rendering macro 'artifact-maven-dependencies-snippet-macro'

com.sun.jersey.api.client.ClientHandlerException: java.net.NoRouteToHostException: No route to host (Host unreachable)

With a downloaded bundle

If you are running a preconfigured Magnolia Tomcat bundle:

  • Stop the Tomcat server (if it was alrewady started).
  • Download the Rest tools bundle 

    Error rendering macro 'artifact-resource-macro'

    com.sun.jersey.api.client.ClientHandlerException: java.net.NoRouteToHostException: No route to host (Host unreachable)

    .
  • Unzip the download and copy all the files to 
    • $tomcat/webapps/magnoliaAuthor/WEB-INF/libs
    • $tomcat/webapps/magnoliaPublic/WEB-INF/libs (if the direcory already exists).

Set the Swagger API base path

..

Setup with a Magnolia for beginners - step by step

...

Testing the setup

..

Security settings

To get started it is fine if you use the rest roles which come with the default setup of your preconfigured Magnolia bundle. 

...

The endpoints - an overview

...

My first REST request

..

Getting familiar with tools



#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels