I am trying to get all the Component Presentations and corresponding Custom Metas by applying a filter on a specific meta. I have formed the query and I am getting the required information I need by using the below query on a browser:

http://www-domain.com/cd_webservice/odata.svc/CustomMetas?$filter=(KeyName eq 'Key' and StringValue eq 'Value') and PublicationId eq ID &$expand=Component/CustomMetas,Component/ComponentPresentations

This gives me the entire data I need, but I am using this in Java and tried calling something like this:

Enumerable<OEntity> customMetas = client.getEntities("CustomMetas").filter(customMetaFilter).execute();

the above code returns the required number of Components tagged with the Keyword but without Component Presentation & all Custom Metas. Hence I used something below:


But nothing works and returning no objects, can someone tell what am I doing wrong?


  • 1
    The trick that you can use is, debug your code and when particular statement is invoked after that you can check odata query it generated. You can modify your code to match with the odata query working for you.
    – Hiren Kaku
    Jul 2 '16 at 6:13
  • Which client API are you using? odata4j? Have you tried others like Olingo from Apache? Jul 4 '16 at 6:26
  • Because each client will expose more or less functionalities depending on its implementation. Jul 4 '16 at 6:34
  • Thanks for the info, yes I am using odata4J, will give a try to Olingo. Meanwhile, I tried to invoke the below query : client.getEntities("CustomMetas").filter(customMetaFilter).execute(); I iterate over Comp Ids and invoked below query to get the CP as well as all the Meta: client.getEntities("ComponentPresentations").expand("Component/CustomMetas").filter(componentPresentationsFilter).execute(); I am not getting null pointer and can get the CP, but when I explored OEntity object in debug mode, I couldn't find the Custom Meta.
    – Yash
    Jul 4 '16 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.