# REST BaqSvc Issue

**URL:** <https://www.epiusers.help/t/rest-baqsvc-issue/51643>\
**Category:** Epicor ERP 10\
**Tags:** baq, rest\
**Created:** [January 21, 2019, 6:16pm UTC](https://www.epiusers.help/t/rest-baqsvc-issue/51643 "2019-01-21T18:16:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkoch](https://www.epiusers.help/letter_avatar_proxy/v4/letter/t/439d5e/32.png) [@tkoch](https://www.epiusers.help/u/tkoch)\
**Post date:** [January 21, 2019, 6:16pm UTC](https://www.epiusers.help/t/rest-baqsvc-issue/51643/1 "2019-01-21T18:16:30Z")

</div>

Having a strange issue where I have a query that will execute fine within the Epicor application, but when called with the same parameters using BaqSvc I get the below error, anyone have any ideas? Also, the query when called via REST runs sometimes with the same parameters… The server log would indicate it is related to a timeout, but it randomly gets this error and runs most of the time via REST. Any settings on the server I could check? @Olga

```auto
https://server/app/api/v1/BaqSvc/ApprovalHierachy?%24filter=LaborDtl7_TimeStatus%20ne%20%27E%27&%24top=1000&CompanyID=700&EmpID=135&emplist=205&emplist=341&emplist=344&emplist=349&emplist=S102&Days=10

```

```auto
{
    "HttpStatus": 400,
    "ReasonPhrase": "REST API Exception",
    "ErrorMessage": "BAQ execution failed with error: \r\nBad SQL statement.\r\nReview the server event logs for details.",
    "ErrorType": "Ice.Common.BusinessObjectException",
    "ErrorDetails": [
        {
            "Message": "BAQ execution failed with error: ",
            "Type": "Error",
            "Program": "Epicor.RESTApi.dll",
            "Method": "ThrowBaqRESTApiException",
            "ColumnNumber": 13,
            "LineNumber": 301
        },
        {
            "Message": "Bad SQL statement.\r\nReview the server event logs for details.",
            "Type": "Error",
            "Program": "Epicor.RESTApi.dll",
            "Method": "ThrowBaqRESTApiException",
            "ColumnNumber": 17,
            "LineNumber": 313
        }
    ]
}

```

Further digging unveiled that if I remove one of the %24 ($ encoded) in the url (doesn’t matter if it is before filter or top) the Get request runs, question is, why?

Further investigation, if I leave the url as is and change the $top oData parameter to 500, it works ☹

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [January 21, 2019, 11:31pm UTC](https://www.epiusers.help/t/rest-baqsvc-issue/51643/2 "2019-01-21T23:31:00Z")

</div>

I don;t know.  
Error looks like security issue, but if it is intermittent, then probably it is really just query timeout?
