API Reference (beta)

The holistic.dev API is organized around REST with JSON request and responses and uses standard HTTP response codes.

Authentication

The holistic.dev API uses API key to authenticate requests. You can view and manage your API key in the Account Settings.

The holistic.dev APIs is a REST-based service. Subsequently, all requests to the APIs require this HTTP header:

x-api-key: Your API key

Content type

The holistic.dev APIs is also a JSON-based service. You have to add Content-Type HTTP header to all your requests:

Content-Type: application/json

URL and API versioning

Only one API version is operating at this time. Use this base URL for your requests:

https://api.holistic.dev/api/v1

Responses

All responses are JSON-based and follow one of these formats:

// successful response
{
  "status": "OK",
  "data": {...}
  }
}

Http codes and error message you can find at Errors section

Projects

The project represents one database. Each project has a name and database type. Each project can contain multiple environments (development, test, stage, production) and various version control system branches.

Create project

project

POST https://api.holistic.dev/api/v1/project

Create new project

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

project.name

string

project name (case insensitive)

project.db

string

"pg" only

Example:

Rename project

project

PATCH https://api.holistic.dev/api/v1/project

Rename project

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

project.name

string

project new name (case insensitive)

project.uuid

string

existing project UUID

Example:

List projects

project

GET https://api.holistic.dev/api/v1/project

Get projects list

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Project details

project/:uuid/details

GET https://api.holistic.dev/api/v1/project/:uuid/details

Get projects list

Path Parameters

Name
Type
Description

uuid

string

project uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Project DDL details

project/:uuid/ddl

GET https://api.holistic.dev/api/v1/project/:uuid/ddl

Get projects list

Path Parameters

Name
Type
Description

uuid

string

project uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Project DMLs list

project/:uuid/dml/list

GET https://api.holistic.dev/api/v1/project/:uuid/dml/list

Get projects list

Path Parameters

Name
Type
Description

uuid

string

project uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

SQL Syntax

At this time, holistic.dev support only PostgreSQL syntax. We have implemented the last original parser from PostgreSQL 13. So, we support modernist PostgreSQL features. PostgreSQL's syntax includes all standard SQL syntax, so, quite possibly, you can parse queries written for other RDBMS - Mysql, MSSQL, ORACLE, and more. But all analyzer rules aim to find specific PostgreSQL behavior.

DDL can contain multiple files. Each of them can include a lot of DDL statements. All unknown or syntactically incorrect statements will be ignored.

DML can contain only one DML statement. All other statements will be ignored. DML can contain one of the following parameter syntaxes:

Database schema (DDL)

DDL, aka Data Definition Language, is an SQL subset that includes CREATE, ALTER, and DROP statements. It uses to define database structure. Also, can include DML statements with extension's commands like create_hypertable() from TimescaleDB. All supported extensions you can find in the extensions list. Knowledge about database structure is the critical requirement for SQL-queries static analysis. We require to upload the database structure described in DDL syntax before process any DML queries.

Extract DDL from database

If you store database schema in your version control system, you can directly upload it for any project.

DDL can contain multiple files, and we store it as is for better navigation.

In case you have not DDL synchronized with production database in your version control system, you should extract DDL directly from target database:

database parameters:

  • <pg-password>

  • <pg-host>

  • <pg-port>

  • <pg-username>

  • <pg-db-name>

Upload DDL

ddl

POST https://api.holistic.dev/api/v1/ddl

Upload brand new ddl or replace existing ddl with new version

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

project.name

string

project name (case insensitive)

ddl.version

string

any string version for history navigate (case insensitive, can be null)

files

array

array of objects { "name": "<filename:string>", "source": "<sql-source:string>" } <sql-source:string> is base64 encoded or not

Example:

We store the history of all schema changes for future features.

Also, you can copy bash script with credentials from project card from project list inside client area:

Project card -> "Copy info" button

Patch DDL

ddl

PATCH https://api.holistic.dev/api/v1/ddl

Patch existing ddl with new DDL commands

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

project.name

string

project name (case insensitive)

ddl.version

string

any string version for history navigate (case insensitive, can be null)

source

string

DDL source code can be base64 encoded or not

Example:

Get DDL source

ddl/:uuid/source

GET https://api.holistic.dev/api/v1/ddl/:uuid/source

Get DDL source by DDL uuid

Path Parameters

Name
Type
Description

uuid

string

ddl uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Get DDL abstract syntax tree

ddl/:uuid/ast

GET https://api.holistic.dev/api/v1/ddl/:uuid/ast

Get DDL abstract syntax tree (AST) by DDL uuid

Path Parameters

Name
Type
Description

uuid

string

ddl uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Get DDL compiled object

ddl/:uuid/object

GET https://api.holistic.dev/api/v1/ddl/:uuid/object

Get DDL compiled object by DDL uuid

Path Parameters

Name
Type
Description

uuid

string

dml uuid

Query Parameters

Name
Type
Description

string

true for YES or any another value for NO

include-partitions

string

true for YES or any another value for NO

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

SQL query (DML)

DML, aka Data Manipulation Language, is an SQL subset that includes SELECT, INSERT, UPDATE, and DELETE statements.

Upload DML

dml

POST https://api.holistic.dev/api/v1/dml

Upload brand new dml or replace existing dml with new version

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

project.name

string

prooject name (case insensitive)

ddl.version

string

any string version for history navigate (case insensitive, can be null)

dml

object

{ "name": "<filename:string>", "version:"<version:string>" "source": { sql: "<sql-source:string>" } } <version:string> can be null <sql-source:string> is base64 encoded or not

Example:

We store the history of all schema changes for future features.

Also, you can copy bash script with credentials from project card from project list inside client area:

Project card -> "Copy info" button

Get DML source

dml/:uuid/source

GET https://api.holistic.dev/api/v1/dml/:uuid/source

Get DML source by DML uuid

Path Parameters

Name
Type
Description

uuid

string

dml uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Get DML abstract syntax tree

dml/:uuid/ast

GET https://api.holistic.dev/api/v1/dml/:uuid/ast

Get DML abstract syntax tree (AST) by DML uuid

Path Parameters

Name
Type
Description

uuid

string

dml uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

Get DML compiled object

dml/:uuid/object

GET https://api.holistic.dev/api/v1/dml/:uuid/object

Get DML compiled object by DML uuid

Path Parameters

Name
Type
Description

uuid

string

dml uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Example:

pg_stat_statements and pg_stat_monitor

The pg_stat_statements and pg_stat_monitor modules provides a means for tracking execution statistics of all SQL statements executed by a server.

The holistic.dev API can process whole pg_stat_statements/pg_stat_monitor snapshot at one request.

Exporting the pg_stat_statements/pg_stat_monitor content is the most comfortable, most flexible, and secure way to organize the automatic export of SQL-queries from Postgresql. This extension is easy to configure for both on-premise installations and cloud providers: AWS, GCP, AZURE, ALIBABA CLOUD, DIGITAL OCEAN, YANDEX CLOUD, SBER CLOUD and others.

pg_stat_statements

POST https://api.holistic.dev/api/v1/pg_stat_statements

Upload pg_stat_statements or pg_stat_monitor snapshot

Headers

Name
Type
Description

x-api-key

string

your api key

Request Body

Name
Type
Description

pgss

string

json string (base64 encoded or not)

project.name

string

project name

holistic.dev parameters:

  • <your-api-key> - your account api key

  • <project-name> - project name

database parameters:

  • <pg-password>

  • <pg-host>

  • <pg-port>

  • <pg-username>

  • <pg-db-name>

Query in sample script aggregat

Check Results

After adding DDL or DML source, we try to parse and analyze it. It can take some time, especially for big DDL. Because of these reasons parsing and analyzing doing asynchronous way. When we ship new parser or analyzer, we rebuild all internal objects and analyze them with new rules. You can reach check results for the last DDL by <project-uuid> or <ddl-uuid>. DML check result can be reached only by <dml-uuid>. All of them have similar results format.

UUID point to exact DDL/DML version, not the last one.

ddl/:uuid/check-result

GET https://api.holistic.dev/api/v1/ddl/:uuid/check-result/

Path Parameters

Name
Type
Description

uuid

string

ddl uuid

Headers

Name
Type
Description

x-api-key

string

your api key

project/:uuid/ddl/check-result

GET https://api.holistic.dev/api/v1/project/:uuid/ddl/check-result/

Path Parameters

Name
Type
Description

uuid

string

project uuid

Headers

Name
Type
Description

x-api-key

string

your api key

dml/:uuid/check-result

GET https://api.holistic.dev/api/v1/dml/:uuid/check-result/

Path Parameters

Name
Type
Description

uuid

string

dml uuid

Headers

Name
Type
Description

x-api-key

string

your api key

Errors

The holistic.dev API uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with holistic.dev's servers.

Error statuses

  • 200 - OK Everything worked as expected.

  • 400 - Bad Request The request was unacceptable, often due to missing a required parameter.

  • 401 - Unauthorized No valid API key provided.

  • 403 - Forbidden The API key doesn't have permissions to perform the request.

  • 404 - Not Found The requested resource doesn't exist.

  • 409 - Conflict The request conflicts with another request (perhaps due to using the same idempotent key).

  • 429 - Too Many Requests Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.

  • 500 - Server Error Something went wrong on holistic.dev's end.

Error response messages

coming soon

Last updated