# Sql access query not working via curl

**URL:** https://discuss.elastic.co/t/sql-access-query-not-working-via-curl/216195
**Category:** Elasticsearch
**Tags:** elastic-stack-sql
**Created:** [January 23, 2020, 8:16am UTC](https://discuss.elastic.co/t/sql-access-query-not-working-via-curl/216195 "2020-01-23T08:16:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [January 23, 2020, 10:46am UTC](https://discuss.elastic.co/t/sql-access-query-not-working-via-curl/216195/2 "2020-01-23T10:46:35Z")

</div>

This has worked for me

```auto
POST /_xpack/sql?format=txt
{
"query": "select \"@timestamp\" from \"foo\" where \"@timestamp\" >CAST('2020-01-23T05:00:00Z' AS TIMESTAMP)"
}

```

maybe you can share the examples that you tried. Keep in mind that you have to create valid JSON.

---

_[View the full topic](https://discuss.elastic.co/t/sql-access-query-not-working-via-curl/216195)._
