Configure a database. Submit a PathQL query. Get nested JSON back.


PathQL extends standard SQL

PathQL allows grouping and nesting of the results of a complex SQL query using JSONPath notation in SQL column aliases. This gives clients the power to ask for exactly what they need and nothing more and enables familiar developer tools.

select 
    posts.id as "$.posts[].id",
    posts.title, posts.content, posts.created
    comments.id as "$.posts[].comments[].id"
    comments.message
from 
    posts, 
    comments 
where 
    post_id = posts.id and
    posts.id = 1 

Ask for what you need, get exactly that

Send a PathQL query to your API and get exactly what you need, nothing more and nothing less. PathQL queries always return structured results in JSON. While typical REST APIs require loading from multiple URLs, PathQL APIs get all the data your app needs in a single request. Apps using PathQL can be quick even on slow mobile network connections.

{
    "posts": [
        {
            "id": 1,
            "title": "Hello world!",
            "content": "Welcome to the first post.",
            "created": "2018-03-05T20:12:56Z",
            "comments": [
                {
                    "id": 1,
                    "message": "Hi!"
                },
                {
                    "id": 2,
                    "message": "Thank you."
                }
            ]
        }
    ]
}

Built on standards

PathQL does not specify it’s own filter language or join syntax, but instead it leverages SQL. You can use JSONPath to group or nest multiple resources in the response JSON. While typical REST APIs require loading from multiple URLs, PathQL can get all the data your app needs in a single request. Apps using PathQL can be quick even on slow mobile network connections.

JSON path

- "$" root element
- "." object child operator
- "[]" array element operator

Segment naming

$.posts[].comments[].message
\__________________/ \_____/
      |                 |
 base path     property name

Create APIs that are consistent and documented

PathQL APIs are organized in an endpoint that is described with an OpenAPI specification. Next to your API documentation you can provide the SQL documentation of your DBMS and an ERD. Authorization is executed in the DBMS using GRANT statements and thus fully documented.

Swagger Editor

Move faster with familiar developer tools

PathQL is an extension to SQL that allows you to structure the resulting JSON. This means that you can keep using the tools you are familiar with, such as DBeaver to create complex queries. And if you want to add a resource to your API, then you simply add a table to your database.

DBeaver

Follow
Follow