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/async/";
// 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": "SELECT * FROM users LIMIT 10",
"worksheet_id": "123e4567-e89b-12d3-a456-426614174000",
"use_admin": false
}
Execute a query asynchronously and return query 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/async/";
// 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": "SELECT * FROM users LIMIT 10",
"worksheet_id": "123e4567-e89b-12d3-a456-426614174000",
"use_admin": false
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Organization ID. This is required for access control. It can be provided via query or request body depending on the endpoint.
Serializer for creating worksheet queries.
The response is of type object
.