Scalong logo Final.png

Support

[email protected]


Table of Contents

Welcome to the DataQ API Documentation!

This documentation is designed to help you seamlessly integrate with the DataQ API, a powerful AI-driven solution that simplifies complex data interactions. The documentation is divided into key sections to guide you through the API's features and provide clear examples for using it across various programming languages.

DataQ is an advanced AI-driven solution designed to streamline data query processes. By automatically generating accurate SQL queries from user input and returning human-readable results, DataQ simplifies complex data interactions, allowing users to obtain meaningful insights with ease. The system is structured to handle various query formats, making it a versatile tool for diverse database environments.


Objective

The primary objective of DataQ is to generate a correct SQL query using AI, based on the user's question, and subsequently provide a human-readable response after executing the query on the original database schema.

API Endpoints

Upload Endpoint

URL: https://dataq-ai.scalong.com/upload/

Method: POST

Description: This endpoint accepts a JSON object containing schema information and a user query. It generates and returns a SQL query in the specified format.

<aside> 📌 Query Types: MySQL, PostgreSQL, SQLite, Microsoft SQL Server (T-SQL), Oracle SQL, MariaDB, IBM Db2,PL/pgSQL, PL/SQL, Elasticsearch SQL, Cassandra Query Language (CQL), Vertica SQL, CockroachDB SQL, Azure Cosmos DB SQL, Presto (Trino) SQL

</aside>

Request Structure:

Property Type Description
message_id string A unique identifier for the request.
query_type string The desired query format (MySQL, PostgreSQL, SQLite, Microsoft SQL Server (T-SQL), Oracle SQL, IBM Db2,PL/pgSQL, PL/SQL, Elasticsearch , Cassandra Query Language (CQL), Vertica SQL, Azure Cosmos DB SQL)
file string A Base64 encoded file containing the schema information provided by the user.
user_question string The question the user wants to ask DataQ.

Example Request:

bashCopy code
curl -X 'POST' \\
  '<https://dataq-ai.scalong.com/upload/>' \\
  -H 'accept: application/json' \\
  -H 'Content-Type: application/json' \\
  -d '{
  "message_id": "09",
  "query_type": "elasticsearch",
  "file": "fQogICAgXQogIH0KfQp9Cg==……………………..",
  "user_question": "What are the best selling chicken products sold in the West Midlands?"
}'

Response Structure:

{
  "sql_query": "SELECT product_description, SUM(quantity) AS total_quantity FROM teraepos WHERE region_name = 'West Midlands' AND product_description ILIKE '%chicken%' GROUP BY product_description ORDER BY total_quantity DESC;",
  "id": "09"
}

Get Final Answer Endpoint

URL: https://dataq-ai.scalong.com/get-final-answer/

Method: POST

Description: This endpoint accepts a JSON object containing the SQL result and the original user query, returning a human-readable response.

Request Structure:

Property Type Description
message_id string The unique identifier used in the Upload Endpoint.
user_question string A string representing the question the user wants to ask DataQ.
sql_result string A string containing the result of the SQL query after it has been executed on the actual schema.

Example Request:

bashCopy code
curl -X 'POST' \\
  '<https://dataq-ai.scalong.com/get-final-answer/>' \\
  -H 'accept: application/json' \\
  -H 'Content-Type: application/json' \\
  -d '{
  "message_id": "09",
  "user_question": "Retrieve the full names and email addresses of all users who joined in the last 30 days",
  "sql_result": "10"
}'

Response Structure:

jsonCopy code
{
  "answer": "In the West Midlands, one of the best-selling chicken products is Chicken Lbabdar.",
  "id": "09"
}

Code Examples

JavaScript (NodeJS)

Python

Java

Go