Query Project
Query an existing project
POST
https://api.app.athenic.com/api/query/project-question
The Athenic AI API uses API keys to authenticate requests. You can view your API keys on your teams settings page.
Projects must be created in the application before querying. This API request will generate valid SQL given an input question / phrase, and the ID of the project to use.
Headers
Request Body
{
"query_id": "Query_ID_Example",
"query_string": "The aliased SQL output to run in our application",
"dataset_raw_query": "The raw SQL you can paste into your database",
"explanation": "An English explanation of how AskEdith answered your question",
}
Request:
import http.client
conn = http.client.HTTPSConnection("api.app.athenic.com")
payload = '{"question": "What is the average sales cycle last quarter?", "project_id": "1234567890"}'
headers = { 'Authorization': "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoiQjZSU0lpRTkifQ.p54KkQWA0icjiKusC6-Odhuii_Y9vbZeaNsJN5PBbEs" }
conn.request("POST", "/api/query/projects", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request POST \
--url https://api.askedith.ai/api/query/projects \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoiQjZSU0lpRTkifQ.p54KkQWA0icjiKusC6-Odhuii_Y9vbZeaNsJN5PBbEs' \
--data '{"question": "What is the average sales cycle last quarter?", "project_id": "1234567890"}'
HttpResponse<String> response = Unirest.post("https://api.askedith.ai/api/query/projects")
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoiQjZSU0lpRTkifQ.p54KkQWA0icjiKusC6-Odhuii_Y9vbZeaNsJN5PBbEs")
.body("{\"question\": \"What is the average sales cycle last quarter?\", \"project_id\": \"1234567890\")
.asString();
var request = require("request");
var options = { method: 'POST',
url: 'https://api.askedith.ai/api/query/projects',
headers: { 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoiQjZSU0lpRTkifQ.p54KkQWA0icjiKusC6-Odhuii_Y9vbZeaNsJN5PBbEs', 'Content-Type': 'application/json'},
body: '{"question": "What is the average sales cycle last quarter?", "project_id": "1234567890"}'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.askedith.ai/api/query/projects",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"question\": \"What is the average sales cycle last quarter?\", \"project_id\": \"1234567890\"}",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoiQjZSU0lpRTkifQ.p54KkQWA0icjiKusC6-Odhuii_Y9vbZeaNsJN5PBbEs",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Last updated