Search api with Like operation not return result

Hi
I use this api url to get all customer that contain word david, but it return empty array.

/api/resource/Customer?fields=["name","customer_name"]&filters=[["customer_name","LIKE","%david%"]]

Does something wrong with the above statement?

Thanks,

Hi @Pheakdey_Tes1,

your api is right.
please apply again and check.

Also, check the below image for reference:

Thanks.

Thank for your clarify.

Yes, the above statement is working good with filter only customer_name field.
I just notice that in my project code it uses combine 2 filter field using or_filters with name field and the search result is not consistent. Especially when I search with keyword contain number and sometime it return error by just change keyword.

Does anyone experience something like this?

Thanks,

I suggest you investigate your URL Encoding.

Postman applies it automatically (optionally), but if it sees a string %nn it may conclude that you are handling URL Encoding yourself and therefore not apply it. Specifically, in your case, it sees %02 and interprets it as “STX” ASCII: start of text.

To debug such situations I typically copy Postman’s suggested curl command and paste it onto the command line. I then keep editing the curl command until I have figured out my error.

“500 Internal Server Error” is HTTPspeak for “Are you kidding me?”

1 Like

I never know about this before.
Thank for your helpful information. I will read this carefully.

Thanks,

@Pheakdey_Tes1

:+1: