Rest API - How to Querying Data using "Contains"

3,759 views
Skip to first unread message

Rezky

unread,
Jul 27, 2023, 5:08:34 AM7/27/23
to iDempiere
Hi Everyone,
How to get data with condition using "contains" in Rest API?

In this Idempiere Rest Wiki there are queries for filter "contains -> if a string contains another string", but when I try it I get an error like in the following image.

Capture.PNG

Thank you for your help.

Regards,
Rezky

Diego Ruiz

unread,
Jul 27, 2023, 6:20:05 AM7/27/23
to iDempiere
Hi Rezky,

The REST API follows the same syntax as oData.

The contains filter is used like contains(columnname,'value'). In your case $filter=contains(Name,'working')

Best regards,
Diego
Message has been deleted
Message has been deleted
Message has been deleted

Rezky

unread,
Jul 27, 2023, 11:55:20 PM7/27/23
to iDempiere
Hi Diego,

I really appreciate your help for the solution.
I've tried it through the API test application and it has worked successfully.
But now I got new problem when I test API before using contains I got this result.
Capture.PNG

But when I try to use 'contains' I got this error.
Screenshot (18).png
Thank you for your help.

Regards,
Rezky

Pada Jumat, 28 Juli 2023 pukul 10.48.37 UTC+7 Rezky menulis:
Hi Diego,

I really appreciate your help for the solution.
I've tried it through the API test application and it has worked successfully.
But now I got new problem when I test API before using contains I got this result.
Capture.PNG

But when I try to use 'contains' I got this error.
Screenshot (17).png

Thank you for your help.

Regards,
Rezky

zuhri...@gmail.com

unread,
Jul 30, 2023, 4:59:26 AM7/30/23
to iDempiere
contains is used to search string in a column. it's working like query "LIKE". if you want to filter by MP_WorkOrder_ID just used C_Bpartner_ID eq xxx AND MP_WorOrder_ID eq xxx

Rezky

unread,
Aug 3, 2023, 4:07:56 AM8/3/23
to iDempiere
Hi Zuhri,

Thanks for the response, yes I understand what you're saying. Sorry, maybe I explained wrong, so in the MP_WorkOrder_ID column (figure 1) we can filter "id" by using the "eq" filter. What I mean is I want to filter the "identifier" column in "MP_WorkOrder_ID". From what I already know and have tried based on the WIKI, namely by "expanding" "MP_WorkOrder_ID" like image below.
Screenshot (20).png

But when I try to "expand" and filter by "contains" I get the following error.
Screenshot (22).png

Thank you for your help.

Regards,
Rezky
Reply all
Reply to author
Forward
0 new messages