Multi-tenant Document API

XIN Mods extends Hippo CMS's Document API for use in Multi-tenanted scenarios

XIN Mods extend a set of new APIs on top of the existing document APIs provided by Hippo CMS out of the box. Because they are added as extensions to the site module and mounted into the web application context, they require authentication. An admin user, or a user with the restuser group can connect and use to these endpoints using HTTP Basic Authentication.

User authentication, combined with restrictive ACLs allows you to organise your content in a way that allows multiple tenants to use the same underlying JCR. Assume all curl commands expressed below have proper authentication headers sent along with them.

XIN Mods NPM package

The information on the rest of this page has been compiled into an easy to use NodeJS package. Use it to easily integrate your frontend stack with the XIN Mods enabled Bloomreach Hippo CMS.
Read more »

Queries

Part of the CaaS (Content as a Service) aspect of the XIN Mods is the ability to query the content by using the custom interpreter built for the HST query variants used in Hippo.

A typical query could look something like this:

(query
    (type with-subtypes 'xinmods:page')
    (offset 100)
    (limit 10)
    (scopes
        (include '/content/documents/xin')
        (include '/content/documents/configuration')
        (exclude '/content/documents/xin/secret')
    )
    (where
        (and
            (= [mods:onsale] true)
            (or
                (> [mods:price] $minPrice)
                (<= [mods:price] $maxPrice)
            )
        )
    )
    (sortby [xinmods:publishedDate] desc)
)

And is sent to the following GET endpoint /site/custom-api/content/query?query=... where query request parameter contains an encoded version of the query description above.

It returns a list of UUIDs of hippo documents that adhere to the query as per its parameters. These UUIDs are to be fed into the /site/api/documents/{uuid} GET endpoint.

Queries can also contain variables $varName notation. When encountered, the value of the query parameter with that same name will be inserted at that location.

Operators

Binary operators:

  • contains: property contains value X (contains 'X')
  • !contains: does not contain
  • >: greater than
  • <: smaller than
  • >=: greater than or equal to
  • <=: smaller than or equal to
  • =: equals
  • !=: does not equal
  • i=: equals (case insensitive)
  • i!=: does not equal (case insensitive)

Unary operators:

  • null: property is null
  • notnull: property is not null

Compound operators:

  • (and X Y): X and Y must both be true
  • (or X Y): X or Y must be true

Other endpoints

Other useful REST endpoints that are available to you are:

  • /site/custom-api/content/path-to-uuid/?path=/jcr/path: Outputs the UUID of a document on a specific path, its type and the UUIDs of its immediate children.
  • /site/api/documents/{uuid}: Outputs a very complete interpretation of the bean at that UUID (commonly used to get more details about the query results' UUIDs), more information to be found here.
  • /site/api/documents: Simple document filtering described here.