Replies: 3 comments 1 reply
-
Hi, thanks for your question. The To authenticate the request, you can use the project's API key, which can be passed in one of the following ways:
Then, you need to provide the SQL statement to be executed and specify the database on which to execute the SQL statement. Using a GET request: Using a POST request: With the body:
|
Beta Was this translation helpful? Give feedback.
-
Ah that is what was missing – when doing a POST, the body needed to be JSON not just the plain-text sql.
Thanks!
From: TizianoT ***@***.***>
Date: Friday, 19 July 2024 at 20:43
To: sqlitecloud/discussions ***@***.***>
Cc: wozdog ***@***.***>, Author ***@***.***>
Subject: Re: [sqlitecloud/discussions] Running queries via weblite sql (Discussion #29)
Hi, thanks for your question.
The /v2/weblite/sql endpoint can be accessed using an authenticated GET or POST request.
To authenticate the request, you can use the project's API key, which can be passed in one of the following ways:
1. As a query string: /v2/weblite/sql?apikey=myapikey
2. As a bearer authorization header: Authorization: Bearer myapikey
Then, you need to provide the SQL statement to be executed and specify the database on which to execute the SQL statement.
Using a GET request:
/v2/weblite/sql?apikey=myapikey&database=chinook.sqlite&sql=SELECT * FROM artists LIMIT 10
Using a POST request:
/v2/weblite/sql?apikey=myapikey
With the body:
{
"sql": "SELECT * FROM artists LIMIT 10",
"database": "chinook.sqlite"
}
—
Reply to this email directly, view it on GitHub<#29 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANUPKXWIVG3SGQXJM3W63NTZNDUT7AVCNFSM6AAAAABLDPEC2SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMBZGQ2TANA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@TizianoT can we add support for {
"sql": "SELECT * FROM artists where name = ? LIMIT 10",
"bind": ["alice"]
"database": "chinook.sqlite"
} |
Beta Was this translation helpful? Give feedback.
-
The weblite REST api seems to work for most of the api (e.g. querying rows from a table) both using postman and via the dashboard weblite documentation, however I can't get the /v2/weblite/sql endpoint to work.
I get the following error with any SQL in the body:
"title": "POST /v2/weblite/sql Bad request"
Any suggestions as to what may be going wrong?
thanks
Beta Was this translation helpful? Give feedback.
All reactions