How to retrieve data from tables in SQL Database

Once you’ve created your SQL Database database, you can begin retrieving data from them.

Go to SQL Database reference

Listing data in a table

Run the following POST request in your terminal, replacing [TOKEN VALUE] with your personal token and {id_database} with the ID of the table you want to retrieve:

Terminal window
curl --location 'https://api.azion.com/v4/edge_sql/databases/{id_database}/query' \
--header 'Authorization: Token [TOKEN VALUE]' \
--header 'Content-Type: application/json' \
--data '{
"statements": [
"SELECT * FROM users;"
]
}'

You should receive the following response:

{
"state": "executed",
"data": [
{
"results": {
"columns": [
"id",
"name"
],
"rows": [
[
1,
"item 1"
],
[
2,
"item 2"
],
[
3,
"item 3"
]
]
}
}
]
}