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.
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.
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.
Binary operators:
Unary operators:
Compound operators:
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.