This document provides a comprehensive specification of the APIJSON protocol, which defines the JSON-based request/call and response format for API communication. The protocol enables frontend clients to define their own data structures and query requirements through JSON, eliminating the need for backend developers to write custom API endpoints.
For information about server-side implementation details, see Core ORM Architecture. For access control and validation mechanisms, see Security and Access Control.
The APIJSON Protocol is a JSON transmission specification that:
This protocol is language-agnostic and can be implemented in any programming language, including Java, Go, C#, PHP, Node.js, Python, and others Document-Chinese.md4-6
The following diagram bridges the "Natural Language Space" of user requests to the "Code Entity Space" by showing how protocol components map to specific interfaces and classes in the APIJSON library.
Title: Protocol to Code Entity Mapping
Sources: Document.md9-12 Document-Chinese.md4-6
APIJSON uses a unified endpoint pattern where all operations use HTTP POST (to accommodate complex JSON bodies), but are distinguished by URL path segments that map to specific logic.
Title: HTTP Method Routing to Protocol Logic
| Method | URL Pattern | Security | Purpose | For details, see |
|---|---|---|---|---|
GET | base_url/get/ | Open | General data retrieval Document.md15 | HTTP API Endpoints |
HEAD | base_url/head/ | Open | Count records and existence check Document-Chinese.md58 | HTTP API Endpoints |
GETS | base_url/gets/ | Secure | Confidential data retrieval Document-Chinese.md21 | HTTP API Endpoints |
POST | base_url/post/ | Secure | Insert new records Document.md10 | HTTP API Endpoints |
PUT | base_url/put/ | Secure | Update existing records Document-Chinese.md21 | HTTP API Endpoints |
DELETE | base_url/delete/ | Secure | Delete records Document-Chinese.md21 | HTTP API Endpoints |
Sources: Document.md15-160 Document-Chinese.md21-23
All APIJSON requests follow a hierarchical JSON structure. By convention, table names must start with an uppercase letter, while keywords and operators use specific symbols.
"User": {}) Document.md9-12"[]" or a custom name with a [] suffix (e.g., "User[]": {}) Document.md50-57For details, see Request Structure and Syntax.
Sources: Document.md46-57 Document-Chinese.md65-75
APIJSON provides field-level operators as key suffixes to perform advanced SQL-like operations within the JSON request.
key{} (IN), key$ (LIKE), key~ (REGEXP) Document-Chinese.md10key% (BETWEEN), key< (Less than), key> (Greater than).key@ (Value reference/join from another object) Document.md103key}{@ (EXISTS) Document.md271For details, see Functional Operators.
Sources: Document.md97-105 Document.md270-272 Document-Chinese.md10
Keywords within an array object control pagination, sorting, and the type of result returned.
count (LIMIT), page (OFFSET) Document.md51-141query (controls return type of the array) Document-Chinese.md107-108join (SQL Join operations) Document.md263For details, see Array Keywords.
Sources: Document.md140-142 Document-Chinese.md68-73
Object keywords (prefixed with @) control query behavior at the table level, such as column selection and grouping.
@column (SELECT fields) Document.md53@order (ORDER BY) Document-Chinese.md58@group (GROUP BY), @having (HAVING) Document-Chinese.md58@schema, @database, @role Document-Chinese.md4-6For details, see Object Keywords.
Sources: Document.md52-54 Document-Chinese.md10
APIJSON supports complex SQL joins using the join keyword combined with operator symbols to define the join type.
&<>|For details, see Join Operations.
Sources: Document.md262-266 Document-Chinese.md280-283
Remote functions allow calling server-side logic using the key() syntax. These functions can be implemented via the server's function parser and integrated with script engines like JSR223.
key-()key()key+()For details, see Remote Functions.
Sources: Document-Chinese.md22
Global parameters affect the entire request context and validation, usually placed at the outermost layer of the JSON request.
tag (Required for POST/PUT/DELETE to match structure in the Request table) Document-Chinese.md10version (API version control) Document-Chinese.md10format (Affects response casing or structure) Document-Chinese.md10For details, see Global Keywords and Parameters.
Sources: Document-Chinese.md10
Refresh this wiki