Legacy Knowledge Base
Published Sep. 10, 2025

Filtering objects by their NestedFields.

Written By

Julián Vela Cubas

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • Having a relationship between two objects A and B.

    It is possible to make queries to the /o/c/as api filtering by a field of object B as nestedField.

curl -X 'GET' \ 
'http://www.localhost:8080/o/c/as/?filter=aB%2Ftext eq 'BBB' &nestedFields=aB' \
-H 'accept: application/json' \
-H 'x-csrf-token: 8LHnmePz'

 

but filtering from the child perspective in the hierarchy (/o/c/bs) seems not to be possible:

curl -X 'GET' \ 
'http:/www.localhost:8080/o/c/bs/?filter=r_aB_c_a%2Ftext eq 'AAA'&nestedFields=r_aB_c_a' \
-H 'accept: application/json' \
-H 'x-csrf-token: 8LHnmePz'
Error: response status is 400
{
"status": "BAD_REQUEST",
"title": "A property used in the filter criteria is not supported: r_aB_c_a/test eq 'AAA'",
"type": "InvalidFilterException"
}

Environment

  • Liferay DXP 7.4+

Resolution

  • In this case the issue is that the filter expression is not the correct one for the bs part. From the API perspective, the relationship name is the same from both sides of the relationship, so, to make queries from (/o/c/bs) you have to use the “same” expression as from /o/c/as:
http://www.localhost:8080/o/c/bs/?filter=aB%2Ftext eq 'AAA' &nestedFields=aB

 

 

Did this article resolve your issue ?

Legacy Knowledge Base