A query language for your API
TreeQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. TreeQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables familiar developer tools.
GET /records/{table} - list records
POST /records/{table} - create a record
GET /records/{table}/{id} - read a record
PUT /records/{table}/{id} - update a record's values
DELETE /records/{table}/{id} - delete a record
PATCH /records/{table}/{id} - increment a record's values
GET /openapi - retrieve api specification
Ask for what you need, get exactly that
Send a TreeQL query to your API and get exactly what you need, nothing more and nothing less. TreeQL queries always return structured results in JSON. Apps using TreeQL are fast and stable because they control the data they get, not the server.
GET /records/posts/1?include=title,content
{
"title": "Hello world!",
"content": "Welcome to the first post.",
}
Get many resources in a single request
TreeQL queries access not just the properties of one resource but also smoothly follow references between them. While typical REST APIs require loading from multiple URLs, TreeQL APIs get all the data your app needs in a single request. Apps using TreeQL can be quick even on slow mobile network connections.
GET /records/posts/1?join=comments,users
{
"id": 1,
"title": "Hello world!",
"content": "Welcome to the first post.",
"created": "2018-03-05T20:12:56Z",
"comments": [
{
id: 1,
post_id: 1,
user_id: {
id: 1,
username: "mevdschee",
phone: null,
},
message: "Hi!"
}
]
}
Create APIs that are consistent and documented
TreeQL APIs are organized in endpoints that are described with an OpenAPI specification. Apps can use the specification to ensure they only ask for what’s possible. TreeQL uses standardized types for the data to ensure Apps are not bound to the underlying database system.
Move faster with familiar developer tools
Keep using the tools you are familiar with, such as Postman and MySQL Workbench. TreeQL is simply an extended REST API that reflects the data structure of the underlying database. So if you want to add a resource to the API, then you simply add a table to your database.