# POST from Elasticsearch: ERR\_UNESCAPED\_CHARACTERS

**URL:** https://discuss.elastic.co/t/post-from-elasticsearch-err-unescaped-characters/209988
**Category:** Elasticsearch
**Tags:** elastic-stack-sql
**Created:** [November 29, 2019, 4:14pm UTC](https://discuss.elastic.co/t/post-from-elasticsearch-err-unescaped-characters/209988 "2019-11-29T16:14:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)
#### Post date: [November 29, 2019, 4:14pm UTC](https://discuss.elastic.co/t/post-from-elasticsearch-err-unescaped-characters/209988/1 "2019-11-29T16:14:03Z")

</div>

I'm trying to implement a transport.request SQL query in a manner similar as to what is done in dev tools. Code is shown below:  
How do i format the request so i don't get these errors?

handler: async req =\> {  
let param = {  
path: '/\_sql?format=json',  
method: 'POST',  
body: {},  
querystring: req.payload.query,  
};  
param.querystring = "'" + req.payload.query + "'";  
console.log('In server route sqlquery:' + JSON.stringify(param));

```
  const { body, statusCode, headers, warnings } = await client.transport
    .request({
      method: param.method,
      path: param.path,
      body: {},
      querystring: param.querystring,
    })

```

In server route sqlquery:{"path":"/\_sql?format=json","method":"POST","body":{},"querystring":"'SELECT ObsDate FROM websphere'"}  
In server route sqlquery error:"ERR\_UNESCAPED\_CHARACTERS: /\_sql?format=json?'SELECT ObsDate FROM websphere'"

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 27, 2019, 4:14pm UTC](https://discuss.elastic.co/t/post-from-elasticsearch-err-unescaped-characters/209988/2 "2019-12-27T16:14:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
