Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replace UAdmin with better term

...

Expand
titleExpand to see the step by step procedure


StepInstructions
1

Choose a directory to work in.

Open a shell and change to the directory of your choice. In our example, we use the directory ~/dev/mgnl-rest-test-base.

Code Block
languagebash
cd ~/dev/mgnl-rest-test-base


2

Download a bundle with Magnolia CLI.

Code Block
languagebash
mgnl jumpstart

Jumpstart downloads and extracts the latest version of magnolia-community-demo-bundle which comes with Tomcat server. Use the -e option to get the magnolia-enterprise-pro-demo-bundle - which will prompt for enterprise credentials. See jumpstart for further options.

Jumpstart also sets the property magnolia.resources.dir in the file magnolia.properties.

Once jumpstart is executed, your directory looks like this:

Code Block
mgnl-rest-test-base/
├── apache-tomcat
├── light-modules
└── magnolia.zip

We will need the light-modules folder later on. (warning) Do not start the Tomcat server yet.

3

Add magnolia-rest tools to your bundle.

Download the REST tools bundle 

Artifact resource link
groupIdinfo.magnolia.rest
artifactIdmagnolia-rest-tools
label$artifactId.zip
renderTypedownload_link
versionSNAPSHOT
resourceTypeZIP
into a temporary folder. Unzip it and copy all the files from the unzipped folder into ~/dev/mgnl-rest-test-base/apache-tomcat/webapps/magnoliaAuthor/WEB-INF/lib. Some of the files may already be there.

4

Start Magnolia.

You are ready to start the Tomcat server for the first time. Go to the "root" directory (/dev/mgnl-rest-test-base) and execute the CLI command start:

Code Block
cd ~dev/mgnl-rest-test-base
mgnl start

(info) During the initial start up, Magnolia installs a lot of configuration data and demo content bootsrapped with its modules - this may take some time.

5

Log in to the author instance.

In your preferred browser, open the URL http://localhost:8080/magnoliaAuthor/ and log in as user superuser with the password superuser.

Now you are nearly done. Have a look around Magnolia. Access the public instance with the URL http://localhost:8080/magnoliaPublic/ .

6

Set the Swagger base API path.

In order to properly use the Swagger UI tools - which are used for development only - you must change one property in the configuration.

On the UAdminAdmin UI, open the Configuration app and find the node /modules/rest-tools/config. (You can use the URL http://localhost:8080/magnoliaAuthor/.magnolia/admincentral#app:configuration:browser;/modules/rest-tools/config:treeview: to go there directly.)

Open the config folder and change the value of the apiBasepath property to: http://localhost:8080/magnoliaAuthor/.rest

7

Restart Magnolia.

Go to the shell where you started Magnolia.

To stop the server, press cmd + C (on Mac) or ctrl + C (on Windows). Give the server some time to properly shut down.

Then start it again:

Code Block
cd ~dev/mgnl-rest-test-base
mgnl start



...

Positive

Seamlessly integrated into the Magnolia UAdminAdmin UI. Comfortable to use form-based interface.

Negative

The endpoints require specific annotations to make them appear on the Swagger UI tools. Delivery endpoint is not annotated and does not appear on the Swagger tools. REST request is sent by the user who logged into Magnolia; it is difficult to test with different users.

...