RE: RE: Headless API Questions/Concerns

Stephen Greco, modified 4 Years ago. New Member Posts: 7 Join Date: 1/22/21 Recent Posts

I am attempting to flatten an API response.  I am trying to get all content items under a folder as well as including content in the subfolders.  The flatten parameter does not seem to work at all.  It only returns the content items in the referenced folder ( 36997 ).  Is there a trick to getting this to work?

http://localhost:8080/o/headless-delivery/v1.0/structured-content-folders/36997/structured-contents?flatten=true

 

I am also trying to see the parent folder of each of the content items, but that does not seem to be available in the structured-contents enpoint.  Does anyone know how to accomplish that?

Thanks

thumbnail
Stephen Greco, modified 4 Years ago. New Member Posts: 9 Join Date: 7/16/20 Recent Posts

I've just check making a test and flatten is working correctly. You just need to add the flatten query parameter with value equals true and all content items of the folders and subfolders should be listed, as you already did. Which version of Liferay are you using?

As you mention, the parent folder of a content item is not available. We can discuss it internally to check if it brings value to add it in the future.

Stephen Greco, modified 4 Years ago. New Member Posts: 7 Join Date: 1/22/21 Recent Posts

We are currently using 7.2.10 GA1  I have tried adding the flatten query parameter to other endpoints that support it and it does not seem to be working for me on any of them.  For example, Knowledge Base Articles does not work either.

http://localhost:8080/o/headless-delivery/v1.0/knowledge-base-folders/38355/knowledge-base-articles?flatten=true

 

Thank you for looking into the Parent Folder options, it seems that the Knowledge Base Articles make more sense for what we are trying to do and they have a parentKnowledgeBaseFolder object for each item.

Stephen Greco, modified 4 Years ago. New Member Posts: 7 Join Date: 1/22/21 Recent Posts

I updated my local version to 7.2.10 with Service Pack 3 and I am now able to flatten the results for structured content, but I still have the issue with the above endpoint.  I am not able to flatten the results for knowledge-base-articles that are under a specific root folder.  

thumbnail
Javier De Arcos, modified 4 Years ago. New Member Posts: 9 Join Date: 7/16/20 Recent Posts

Ok, I've reproduce it and in the case of Knowledge Base Articles seems like a bug to me. I'll open a ticket describing it and try to fix it as soon as we can

Stephen Greco, modified 4 Years ago. New Member Posts: 7 Join Date: 1/22/21 Recent Posts

Thanks.  Would you like us to open a ticket from our end for this?

thumbnail
Javier De Arcos, modified 4 Years ago. New Member Posts: 9 Join Date: 7/16/20 Recent Posts

Yes, please. Better if you open the ticket to provide a more detail information about the situation and environment you had.

Thank you very much and sorry for the inconveniences