MULTI-TENANT DOCUMENT API
XIN MODS EXTENDS BLOOMREACH XM'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 BloomReach XM 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.
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 Bloomreach XM.
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 Bloomreach 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
Below you can see a video that shows you how to use queries using the XINmods NodeJS API:
Writing dynamic queries using the Query API is very straightforward, check out the video below.
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.
Go back to the overview to discover more functions of XIN Mods.