How are you building your URL to call the REST service? If you are appending String elements you may have some illegal characters that you need to escape. If they are parameters pass them through the urlEncode function.
For example...
'http://google.com/search?q=' + urlEncode($myQuery)
https://docs.mendix.com/refguide/string-function-calls/#urlEncode