Sql access query not working via curl

This has worked for me

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.