Hippo CMS Rest Api does not return content of linked documents

480 views Asked by At

I am trying to configure in Hippo CMS Community Version a custom documenttype (A) that references another custom documenttype (B). Note that B is configured as multi valued. The idea is to get the content information by means of a rest endpoint all together in a JSON response.

I use the cms ui http://localhost:8080/cms/ to insert the documenttypes and http://localhost:8080/essentials/ bean writer to generate the beans. Both documenttypes (A and B) are of type basedocument.

After setting the documenttypes and rest endpoint for both beans, I am facing the problem that only those field values directly configured on A are retrieved. The content of referenced documents (that used DocumentType B) are not included in the response.

Content of B can be retrieved only if they are explicitely requested using the rest api by means of its documenttype identificator.

The expected behaviour should be the same as the one obtained when requesting the Blogpost DocumentType given in hippo out-of-the-box. In that case, Blogpost contains author references that are returned together in the json response.

I have being working with hippo for more or less two weeks and I thought it should be easy to configure the documenttypes, but evidently I am missing something.

The DocumentTypes are configured as follows:

Documenttype A (basedocument):

Name -> type String

Element -> Link NodeType:DocumentType B (multivalued)


DocumentType B (basedocument):

Key -> type String

Value -> type String

I will appreciate very much any help about it.

1

There are 1 answers

2
grunfy On

Just go to tools section of Essentials project (http://localhost:8080/essentials ) and re-generate HST beans. Once done, your document A should have a new method, something like: List<B> getB(). After that you can use that method to populate your REST response objects.