Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

This page explains how you can add assets such as images to the Magnolia Digital asset management (DAM) through REST.

Understanding the basics

Magnolia provides a digital asset management system which stores data in the dam JCR workspace. The assets can be managed with the Assets app, but you can also use REST's Nodes endpoint to add them to the workspace or update them there.

Using REST to add nodes

The Nodes endpoint API provides methods to create, update, and delete nodes in any Magnolia JCR workspace, which makes it suitable for asset management. The endpoint comes with an important restriction in the given context: (warning) You can add only one node per request. You cannot put nested nodes.

We recommend that you first take a look at the Nodes endpoint API documentation.

Security

When using REST in a production environment, you should be also familiar with REST security. In the following example, we use the superuser to add an asset to the Magnolia author instance. In a production environment, you should use another user who you have to grant the required permissions. Please see REST security to set up the security accordingly.

Below we use cURL to send the REST requests. The requests contain the user name (superuser) and the password, which is a crude way of authentication. Do this only if you send the requests via SSL using the https protocol.

Structure of asset nodes in the dam workspace

The Magnolia DAM stores assets in the following manner: 

Node nameValue exampleNode type

 my-asset


mgnl:asset

  name

logo

 jcr:content


mgnl:resource

 jcr:data

iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFC...

The node scheme above is simplified in that it omits some properties. Please note the following things:

  • The main node of the asset is of the  mgnl:asset node type.
  • The main node has a direct subnode of the mgnl:resource type.
  • The subnode contains the jcr:data property which stores the binary data. The binary data is stored in the Base64 format. (The value has been truncated for better readability.)

Adding an asset

In this example, let's add the following image to the root directory of the workspace.

noodle-soup.png noodle-soup.png

To add it, you have to accomplish the following tasks:

  1. Add a node of the mgnl:asset type to the desired path in the dam workspace. The node must contain all the properties which you want to add as metadata.
  2. Add another node as a subnode of the first node.
    1. Node type: mgnl:resource
    2. Node name: jcr:content.
    3. With the jcr:data property, which must contain binary data in the Base64 format.

This means you have to send at least two requests to add an asset.

Adding the mgnl:asset node with the metadata

Create a new asset 'noodle-soup' in dam root
curl http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/dam \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X PUT \
  --user superuser:superuser \
  --data \
'{
  "name": "noodle-soup",
  "type": "mgnl:asset",
  "path": "/noodle-soup",
  "properties": [
    {
      "name": "type",
      "type": "String",
      "multiple": false,
      "values": [
        "png"
      ]
    },
    {
      "name": "name",
      "type": "String",
      "multiple": false,
      "values": [
        "noodle-soup"
      ]
    },
    {
      "name": "type",
      "type": "String",
      "multiple": false,
      "values": [
        "png"
      ]
    },
	{
	  "name": "title",
	  "type": "String",
      "multiple": false,
      "values": [
        "I love noodle soup"
      ]
	}
  ]
}'

You can check the upload of the metadata using the Assets app. If you run a Magnolia instance locally, you can use the following URL to go to the asset directly: http://localhost:8080/magnoliaAuthor/.magnolia/admincentral#app:assets:detail;/noodle-soup:edit. Note that there is no binary data added to the asset so far.

Adding the mgnl:resource node with the binary data

Create subnode with the png as a child of /noodle-soup
curl http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/dam/noodle-soup \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X PUT \
  --user superuser:superuser \
  --data \
'{
  "name": "jcr:content",
  "type": "mgnl:resource",
  "path": "/noodle-soup/jcr:content",
  "properties": [
    {
      "name": "jcr:data",
      "type": "Binary",
      "multiple": false,
      "values": [ "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4z8AAAAMBAQAY3Y2wAAAAAElFTkSuQmCC" ]
    },
    {
      "name": "height",
      "type": "Long",
      "multiple": false,
      "values": [
        "5"
      ]
    },
    {
      "name": "width",
      "type": "Long",
      "multiple": false,
      "values": [
        "5"
      ]
    },
    {
      "name": "extension",
      "type": "String",
      "multiple": false,
      "values": [
        "png"
      ]
    },
    {
      "name": "fileName",
      "type": "String",
      "multiple": false,
      "values": [
        "noodle-soup.png"
      ]
    },
    {
      "name": "jcr:mimeType",
      "type": "String",
      "multiple": false,
      "values": [
        "image/png"
      ]
    }
  ]
}'

Line 16 contains the data for the Base64-encoded image. (warning) For better readability of this example, the data does not contain the image of the noodle soup icon but just a 1 by 1 pixel png.

 Expand to get the Base64 data for the noodle soup image.
iVBORw0KGgoAAAANSUhEUgAAAUUAAAEvCAAAAAD3cIy9AAAqc0lEQVR42u1dd0AU1/M/OoIVG8GGxqBfG9hiVxJ7R+yINfagWMGoCCo27IogiI3Ygr1hQcUuKmrQoMZgVxQQG0oTbn/ce2933+7t3u3d7R3Hz51/4N3ubfncKzPzmZknIyTRXWQSBBKKEooSipJIKEooSihKKEoioSihKKEooSiJhKKEooSihKIkEooSihKKkkgoSihKKEooSiKhKKEollzqX6eMTYsJx/IkFLWW1JYyJJWOSShqKUnVZLTMk1DUSj5UkuGyU0JRG+nCAFFW7LWEouayD6FXum0D+M9ACUWNJb82gK7CRTlBRJko/jV5IaGoqfwJQLS8CxoTQGODhKKGklcDADcZtm6Bho+EooYSDnCzfgdbb0BrkoSiZpJbEeD2B2qeBK0gCUXNZA2ArdRH1OwFmnslFDWSrLIAtoWoeR60bL5KKGokSwBsZb/AlrwOaP4u6YsayZdSALaVqBkGWlaS7aKZzAOwVcyCrU/lQXMO18h/dO2FXEKRU97ZAthCUXMmaJVXmhXzt7c3VViIE+5KKHIIhK0y8sw+swDNreyz/mtM+ilMhqdKKLLlrTXAZjtq9gGthuyzHpbA/D21UyUUWfI7BCYf13Jk19hQOzDcZi55EooMeWmBq9hIy+nHOknelul8lC2TUGTIKIBKA4Y9bfGMddJSiF21mf6j4fgvkyuhiMljM4BKNEPLmcU66bY5+LilYt3+pzL4/4CEIiaDASZNUcuHU8v5Uh32vzegtV+4w+d7QfEBHKoXGVpOBOukYfAkxK7mgZN6SCjS4gbw6Yha7qBVh2WeIEZmItm2UrQ6SyhSkgABusHQcs4zz3kBNUUnZCAS/4Cmp4QiJZ0AIr0ZWk4fluHXDDIy98gPOoL2WglFUi7CzvcAtjZxajlz4TnryXYgtAKfSiiS0hQgMhg2vkItZybzlAum4NMOZDsGtjtJWjcpkF4xewxbvlDL+cQ45b09+NQ+DbWfQ1ek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MFAsmB/XsXaBaOR7Wvfp/14gq2pmnXUGsjgLB8UCuTDIklXwt63/sVStL/fl7LRqrOsNvmCwlyk0FAsmsLC2Srm5ld0WndR0nsy8vHbo/1hXMmm78b0BX6UQUSyQF0vrc9UncF/41x1BAzz14rrh9ZR3qm6w9LVh36NwUVTYaHOq82Ttuw6etnzHufsflL+T9zr+6KYAz2acuxTVmGN4sqzQUSyQOO8KqnJOrRxbtKOktUtNexUVze294wrjDYwBRYKQ31nZo4SuCeYluq+8LS+c5zcOFMEwvb6kdwVtEbTvtTSuEIMHjAdFqDXv9/2lomYAVmzvu/9lIT+2kaEI5N3F0Em/1jBTB59F9Q5eIRfeG8MTGyOKSPJfnN8SMGP8UPfOrRs6VSptZlG6klPDNp3dh46fPn9L7HNjihs3YhSLkEgoSihKKEooSiKhKKEooSihKImEooSihKKEoiQSihKKEooSipJIKEooSihKIqEooWg88n+NSlU7EmfXxQAAAABJRU5ErkJggg==

About Base64 image encoding

As shown above, to send binary image data, you have to Base64-encode the file. If you want to follow the example, you can use online services such as http://b64.io/ or https://www.base64-image.de/, which return the data in the following format:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4z8AAAAMBAQAY3Y2wAAAAAElFTkSuQmCC

This format is required for instance when you add Base64 data into a CSS or HTML file. In our REST case, please do not use the leading data:image/png;base64 part. Copy/paste only the part coming after the first comma.

Requirements

To use the Nodes endpoint API, your Magnolia bundle must contain the REST module, particularly the magnolia-rest-services module. Preconfigured Magnolia webapps already contain the Magnolia REST modules. If you need to install the modules, see REST module - Installing.

Image credits

https://www.flaticon.com/free-icon/noodles_94375