Access Repository Contents via an External Application

Hello,

I am newbie to the Hippo cms world (started a couple of days ago) .

I have a requirement where I need to integrate a Spring application (a batch process) to fetch the latest Hippo Repository Contents (news, to be specific) with a constraint where the published timestamp of a content is greater than the last timestamp when this batch process was run.

I tried the rest API to fetch the json https://www.onehippo.org/library/concepts/rest/content-rest-api/document-collection-resource.html , however, it seems it does not support less than or greater than functionality in the URL parameters.
I also read about CRISP API https://www.onehippo.org/library/concepts/crisp-api/configuration/example-with-simple-json-rest-api.html, however it requires a freemaker template which in my case is not relevant as I want to fetch the raw json. Also, I am not able to figure out where should this code reside in client module.
ResourceServiceBroker broker = HippoServiceRegistry.getService(ResourceServiceBroker.class);
Resource productCatalogs = broker.findResources(“demoProductCatalogs”, “/products/”);
request.setAttribute(“productCatalogs”, productCatalogs);

Lastly, I also looked at https://www.onehippo.org/library/concepts/fluent-search/fluent-hstquerybuilder-bootstrapping.html It does look close to what I am looking for, do I need to configure the rest API end-point in client module so that I can access it from the other backend application?

Thanks,
Ankit

Hi Ankit,

Welcome!

It would have been easier for you if it supported an extra JCR query expression parameter. But it seems not according to the online documentation, unfortunately. Otherwise, please chime in.

CRISP API is to enable external resource retrievals and content enrichment in CMS-based applications, not for your current use case, IMO.

Assuming you want to build an external (i.e, out of cms tomcat process) application for the batch jobs, it seems good to provide a REST service in the content delivery web application (e.g, “/site/api/mylatestcontent”, …) and let the external batch job apps consume it.
If so, you should implement and configure Plain JAX-RS service(s) using HstQuery which wraps JCR Query API in HST framework layer:

Regards,

Woonsan

Hello Woonsan,

Thanks for the detailed explanation. Yes the third solution to use JAX-RS with HST Query works. Also while I was looking for a solution, I also tried using Hippo event to subscribe for WorkflowEvent and check the action type as “publish”. This also worked and it turned out to be a real-time push notification solution for my case.

Thanks for your help!

Regards,

Ankit