Using wildcards like (LineDesc LIKE '%test%') in REST

Does anyone know how to use wildcards in the REST API (or if it’s possible)?

Something like where the OrderDtl LineDesc contains “test”?

Thanks,

Josh

The OrderDtl LineDesc search is just a BAQ (Quick Search). You would use the BAQSvc which is undocumented in v2 REST but it’s still there. See the v1 documentation.

1 Like

It’s odata so you could use

substringof

Function

https://services.odata.org/Northwind/Northwind.svc/Customers?$filter=substringof('Alfreds', CompanyName) eq true

See: URL Conventions (OData Version 3.0) · OData - the Best Way to REST

Thanks for the reference Jose! We’re using version 2, and I do see the substringof method in the version 2 url conventions (URI Conventions (OData Version 2.0) · OData - the Best Way to REST). However, it doesn’t appear to recognize the function…

/api/v2/odata/WGR/Ice.BO.UD28Svc/UD28s?$filter=substringof(‘26’%2C%20TransData_c)%20eq%20true

{
“HttpStatus”: 400,
“ReasonPhrase”: “REST API Exception”,
“ErrorMessage”: “An unknown function with name ‘substringof’ was found. This may also be a function import or a key lookup on a navigation property, which is not allowed.”,
“ErrorType”: “Microsoft.OData.ODataException”
}

You can’t be using oData V2
Epicor REST V1 is oData V3
OR
Epicor REST V2 is odata V4

If you are using Epicor V2 then it is odata V4 and so you should use indexof or contains (if contains isn’t implemented use indexof)

indexof('26', TransData_c) gt 0

Thanks for the clarification on the versions… Looks like we’re using Epicor REST V2.

After trying the contains and indexof as illustrated in the Epicor REST Services v.2 documentation, I still get errors (even though it shows contains and indexof as available string functions). I’ll mess around with it some more.

Thanks again for your help!