# Bad request error on use of special characters

**URL:** <https://community.dreamfactory.com/t/bad-request-error-on-use-of-special-characters/4093>\
**Category:** REST API\
**Created:** [September 26, 2017, 10:00am UTC](https://community.dreamfactory.com/t/bad-request-error-on-use-of-special-characters/4093 "2017-09-26T10:00:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cocomo](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@cocomo](https://community.dreamfactory.com/u/cocomo)\
**Post date:** [September 26, 2017, 10:00am UTC](https://community.dreamfactory.com/t/bad-request-error-on-use-of-special-characters/4093/1 "2017-09-26T10:00:42Z")

</div>

I want to filter a field of type mediumtext for the equal sign. But that throws a 400 Bad Request error. I get the same result when I filter for the greater-than or smaller-than sign. I guess because these symbols conflict with the SQL comparison operators.  
I am making a request to MySQL Maria database via the dreamfactory’s API.

I tried escaping the equal sign with a backslash, but it did not work.

What can I do now?

Details:  
Request URL: …/mytablename?fields=content&filter=content%20like%20%25%3D%25  
Response Body:  
{  
“error”: {  
“code”: 400,  
“context”: null,  
“message”: “Invalid or unparsable field in filter request: ‘content like %’”,  
“status\_code”: 400  
}  
}

---

<div class="post-metadata">

**Author:** ![LBat](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/lbat/32/1004_2.png) [@LBat](https://community.dreamfactory.com/u/LBat)\
**Post date:** [March 7, 2018, 3:57pm UTC](https://community.dreamfactory.com/t/bad-request-error-on-use-of-special-characters/4093/2 "2018-03-07T15:57:54Z")

</div>

Hello,

It’s a old post, but to users having same problem can be a solution:

In SQL to use the LIKE you must use this format:

> content like “%my search%”  
> (return all record with the words: my search)

The Cocomo request url  
`Request URL: …/mytablename?fields=content&filter=content%20like%20%25%3D%25`  
is the same as:  
`Request URL: …/mytablename?fields=content&filter=content like %=%`

The problem, Dreamfactory have a limitation/bug in SQL query function:  
The sign: **=** , cannot be used in the LIKE instructions, and get the message error;

I think because of conversion (encode/decode) to JSON the url string gets scrambled!  
`----------------------------------------------------------------------------------------------------------------

You can try/test string encode (or decode) in this Url:  
Encode: [test rawurlencode online - PHP URL functions - functions-online](https://www.functions-online.com/rawurlencode.html)  
Decode: [test rawurldecode online - PHP URL functions - functions-online](https://www.functions-online.com/rawurldecode.html)

One recommendation is to use the filter like this:  
`Request URL: …/mytablename?fields=content&filter=(content%20like%20%22%25my%20search%25%22`)

_ **Other solution to validate filters** _ is using the “API DOCS” menu option in DreamFactory dashboard, go to the database service, select the:

`GET /mydatabase/_table/{table_name}` api endpoint

In there you have the field **filter** , where you put your query: `(content like "%my search%")`  
and when make the call (button “Try it out!”), dreamfactory show the Request Url endpoint formatted, then copy and past in your code.

Regards,  
LB
