Problems with SQL request to SeaTable

Hi, I`m trying to use SQL request to SeaTable:

curl --location --request POST 'https://some-domain/dtable-server/api/v1/dtables/a0124c53-855f-4b5a-9bf3-k27a0a103176/query' --header 'Authorization: Token <some-token>' --header 'Content-Type: application/json' --data-raw '{"sql":"select Name from Project"}'

and got the next

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/v1/dtables/a0124c53-855f-4b5a-9bf3-k27a0a103176/query</pre>
</body>
</html>

Another types of POST, like inserting a row, execute successfully.

Hi, are you using self-hosted? May I ask which version of SeaTable are you using? The SQL request is only available in the latest versions.

Thanks for reply! Yeah, we use self-hosted seatable, v.2.0.

I also tried to test sql request with cloud:

curl --location --request POST 'https://cloud.seatable.io/dtable-server/api/v1/dtables/ae3e987c-beb6-4262-a112-d0ddd7ad3602/query/' --header 'Authorization: Token <some-token>' --header 'Content-Type: application/json' --data-raw '{"sql":"select Category from Expenses"}'

and got

{"error_msg":"Invalid jwt token."}

But token is 100% correct, row insert work with it.

OK, the SQL is not supported before v2.2!
And I think we have already uploaded v2.2, if you need to test SQL, you could upgrade to v2.2.

And for the upgrade, please consult the Upgrade manual - SeaTable Admin Manual. (There has been several reports on the forum that the upgrade fails, all of them was because they didn’t follow the instruction!)

1 Like

Thanks a lot!
Maybe you have any thoughts about my problem with cloud?

Oops, sorry, I oversaw that.
This should be an issue from our side, thanks for letting us know! We’ll investigate internally and come back to you asap here…

Hi, we just fixed the problem and the SQL query should work again with API. I just tested and it worked by me.

Could you give it a try and let me know if it works?

Yeah, I tested and it works, thank you for such a quick solution!

1 Like