N1ql Rest Api syntax error

I am stuck trying to get the n1ql rest api to respond to my request. I am running the following request through a java http client lib. For the life of me I can’t figure out what the syntax error is. The url works fine through curl which makes me think its something todo with the client lib.

Any help is welcome.

Request method: GET
Request URI: http://localhost:56351/query?statement=SELECT%20*%20FROM%20`YS_Apps`%20WHERE%20docType%20%3D%20’MandateEventDO’%20AND%20eventId%20%3D%20’EVN123’
Proxy:
Request params:
Query params: statement=SELECT%20*%20FROM%20%60YS_Apps%60%20WHERE%20docType%20%3D%20%27MandateEventDO%27%20AND%20eventId%20%3D%20%27EVN123%27
Form params:
Path params:
Headers: Authorization=Basic blahblah=
Accept=/
Cookies:
Multiparts:
Body:
{
“requestID”: “dc0cec0e-e42d-4a3f-824d-e37d8ecac4f3”,
“errors”: [
{
“code”: 3000,
“msg”: “syntax error - at %!(NOVERB)”
}
],
“status”: “fatal”,
“metrics”: {
“elapsedTime”: “662.2µs”,
“executionTime”: “390.7µs”,
“resultCount”: 0,
“resultSize”: 0,
“errorCount”: 1
}
}

Here is the working curl
curl -v -H “Authorization : Basic blahblah” http://localhost:54488/query?statement=SELECT%20*%20FROM%20`YS_Apps`%20WHERE%20docType%20%3D%20’MandateEventDO’

Make sure your quotes properly escaped. (single quote inside quote needs properly escaped. same for double quotes). Also it doesn’t conflict with url escape characters. If needed use JSON format.

curl -v  -H "Authorization : Basic blahblah" http://localhost:8093/query/service -d 'statement=SELECT * FROM `YS_Apps` WHERE docType = "MandateEventDO" AND eventId = "EVN123"'
curl -v  -H "Authorization : Basic blahblah" http://localhost:8093/query/service -H "Content-Type: application/json"  -d '{"statement":"SELECT * FROM `YS_Apps` WHERE docType = \"MandateEventDO\" AND eventId = \"EVN123\""}'