Database
Run Query
Run a query as in Roe AI workspace.
POST
/
v1
/
database
/
query
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string token = "YOUR_API_TOKEN"; // Replace with your API token
string url = "https://api.roe-ai.com/v1/database/query/";
// Create payload
var payload = new
{
query = "YOUR_SQL_QUERY", // Replace with your SQL query
organization_id = "3c90c3cc-0d44-4b50-8888-8dd25736052a"
};
string jsonPayload = JsonSerializer.Serialize(payload);
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Create request content
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
// Send request
HttpResponseMessage response = await client.PostAsync(url, content);
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
[
{
"query_id": "123e4567-e89b-12d3-a456-426614174000",
"query": "SELECT * FROM example",
"summary": {
"read_rows": 3,
"read_bytes": 123,
"written_rows": 0,
"written_bytes": 0,
"total_rows_to_read": 3,
"result_rows": 3,
"result_bytes": 123,
"elapsed_ns": 1000000,
"query_id": "123e4567-e89b-12d3-a456-426614174000"
},
"row_count": 3,
"column_names": [
"name",
"file",
"created_at"
],
"column_types": [
"String",
"String",
"DateTime"
],
"result_rows": [
[
"example1.pdf",
"file_123e4567-e89b-12d3-a456-426614174001",
"2024-04-29 21:11:17+00:00"
],
[
"example2.png",
"file_123e4567-e89b-12d3-a456-426614174002",
"2024-04-29 21:11:18+00:00"
],
[
"example3.mp4",
"file_123e4567-e89b-12d3-a456-426614174003",
"2024-04-29 21:11:19+00:00"
]
],
"start_timestamp": 1719852303.0115254,
"end_timestamp": 1719852303.0204659
}
]
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Response
200
application/json
Query results
The response is of type object[]
.
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string token = "YOUR_API_TOKEN"; // Replace with your API token
string url = "https://api.roe-ai.com/v1/database/query/";
// Create payload
var payload = new
{
query = "YOUR_SQL_QUERY", // Replace with your SQL query
organization_id = "3c90c3cc-0d44-4b50-8888-8dd25736052a"
};
string jsonPayload = JsonSerializer.Serialize(payload);
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Create request content
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
// Send request
HttpResponseMessage response = await client.PostAsync(url, content);
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
[
{
"query_id": "123e4567-e89b-12d3-a456-426614174000",
"query": "SELECT * FROM example",
"summary": {
"read_rows": 3,
"read_bytes": 123,
"written_rows": 0,
"written_bytes": 0,
"total_rows_to_read": 3,
"result_rows": 3,
"result_bytes": 123,
"elapsed_ns": 1000000,
"query_id": "123e4567-e89b-12d3-a456-426614174000"
},
"row_count": 3,
"column_names": [
"name",
"file",
"created_at"
],
"column_types": [
"String",
"String",
"DateTime"
],
"result_rows": [
[
"example1.pdf",
"file_123e4567-e89b-12d3-a456-426614174001",
"2024-04-29 21:11:17+00:00"
],
[
"example2.png",
"file_123e4567-e89b-12d3-a456-426614174002",
"2024-04-29 21:11:18+00:00"
],
[
"example3.mp4",
"file_123e4567-e89b-12d3-a456-426614174003",
"2024-04-29 21:11:19+00:00"
]
],
"start_timestamp": 1719852303.0115254,
"end_timestamp": 1719852303.0204659
}
]