@@ -4,8 +4,6 @@ description: Comprehensive reference for the ForgeBase API REST endpoints
44icon : ' lucide:book-open'
55---
66
7- # REST API Reference
8-
97ForgeBase API automatically creates RESTful endpoints for your database. This page provides a comprehensive reference for all available endpoints.
108
119## Base URL
@@ -18,31 +16,31 @@ These endpoints allow you to manage your database schema.
1816
1917### Get Database Schema
2018
21- ``` http
19+ ``` http [http]
2220GET /api/db/schema
2321```
2422
2523Returns the complete database schema, including all tables, columns, and relationships.
2624
2725### Get Tables
2826
29- ``` http
27+ ``` http [http]
3028GET /api/db/schema/tables
3129```
3230
3331Returns a list of all tables in the database.
3432
3533### Get Table Schema
3634
37- ``` http
35+ ``` http [http]
3836GET /api/db/schema/tables/:tableName
3937```
4038
4139Returns the schema for a specific table, including all columns and relationships.
4240
4341### Create Table
4442
45- ``` http
43+ ``` http [http]
4644POST /api/db/schema
4745Content-Type: application/json
4846
@@ -60,7 +58,7 @@ Creates a new table with the specified columns.
6058
6159### Add Column
6260
63- ``` http
61+ ``` http [http]
6462POST /api/db/schema/column
6563Content-Type: application/json
6664
@@ -76,7 +74,7 @@ Adds one or more columns to an existing table.
7674
7775### Drop Column
7876
79- ``` http
77+ ``` http [http]
8078DELETE /api/db/schema/column
8179Content-Type: application/json
8280
@@ -90,7 +88,7 @@ Removes a column from an existing table.
9088
9189### Add Foreign Key
9290
93- ``` http
91+ ``` http [http]
9492POST /api/db/schema/foreign_key
9593Content-Type: application/json
9694
@@ -110,7 +108,7 @@ Adds a foreign key constraint to a table.
110108
111109### Drop Foreign Key
112110
113- ``` http
111+ ``` http [http]
114112DELETE /api/db/schema/foreign_key
115113Content-Type: application/json
116114
@@ -124,7 +122,7 @@ Removes a foreign key constraint from a table.
124122
125123### Delete Table
126124
127- ``` http
125+ ``` http [http]
128126DELETE /api/db/schema/tables/:tableName
129127```
130128
@@ -136,7 +134,7 @@ These endpoints allow you to perform CRUD operations on your data.
136134
137135### Create Record
138136
139- ``` http
137+ ``` http [http]
140138POST /api/db/create/:tableName
141139Content-Type: application/json
142140
@@ -152,7 +150,7 @@ Creates a new record in the specified table.
152150
153151### Query Records
154152
155- ``` http
153+ ``` http [http]
156154POST /api/db/query/:tableName
157155Content-Type: application/json
158156
@@ -171,15 +169,15 @@ Queries records from the specified table with filtering, pagination, and sorting
171169
172170### Get Record by ID
173171
174- ``` http
172+ ``` http [http]
175173GET /api/db/get/:tableName/:id
176174```
177175
178176Retrieves a specific record by its ID.
179177
180178### Update Record
181179
182- ``` http
180+ ``` http [http]
183181PUT /api/db/update/:tableName/:id
184182Content-Type: application/json
185183
@@ -195,7 +193,7 @@ Updates a specific record by its ID.
195193
196194### Advanced Update
197195
198- ``` http
196+ ``` http [http]
199197POST /api/db/update/:tableName
200198Content-Type: application/json
201199
@@ -213,15 +211,15 @@ Updates multiple records that match the filter criteria.
213211
214212### Delete Record
215213
216- ``` http
214+ ``` http [http]
217215DELETE /api/db/del/:tableName/:id
218216```
219217
220218Deletes a specific record by its ID.
221219
222220### Advanced Delete
223221
224- ``` http
222+ ``` http [http]
225223POST /api/db/del/:tableName
226224Content-Type: application/json
227225
@@ -240,15 +238,15 @@ These endpoints allow you to manage row-level security permissions.
240238
241239### Get Table Permissions
242240
243- ``` http
241+ ``` http [http]
244242GET /api/db/permissions/:tableName
245243```
246244
247245Returns the permissions for a specific table.
248246
249247### Set Table Permissions
250248
251- ``` http
249+ ``` http [http]
252250POST /api/db/permissions/:tableName
253251Content-Type: application/json
254252
@@ -261,7 +259,7 @@ Content-Type: application/json
261259 { "allow": "auth" }
262260 ],
263261 "UPDATE": [
264- { "allow": "auth",
262+ { "allow": "auth",
265263 "fieldCheck": {
266264 "field": "user_id",
267265 "operator": "===",
@@ -281,7 +279,7 @@ Sets the permissions for a specific table.
281279
282280### Delete Table Permissions
283281
284- ``` http
282+ ``` http [http]
285283DELETE /api/db/permissions/:tableName
286284```
287285
@@ -295,31 +293,31 @@ Many endpoints support query parameters for filtering, pagination, and sorting:
295293
296294You can filter records using the ` filter ` parameter:
297295
298- ``` http
296+ ``` http [http]
299297GET /api/db/query/users?filter={"name":"John"}
300298```
301299
302300### Pagination
303301
304302You can paginate results using the ` limit ` and ` offset ` parameters:
305303
306- ``` http
304+ ``` http [http]
307305GET /api/db/query/users?limit=10&offset=0
308306```
309307
310308### Sorting
311309
312310You can sort results using the ` orderBy ` parameter:
313311
314- ``` http
312+ ``` http [http]
315313GET /api/db/query/users?orderBy=[{"column":"name","order":"asc"}]
316314```
317315
318316### Column Selection
319317
320318You can select specific columns using the ` select ` parameter:
321319
322- ``` http
320+ ``` http [http]
323321GET /api/db/query/users?select=["id","name","email"]
324322```
325323
@@ -347,7 +345,7 @@ All endpoints return standard HTTP status codes:
347345
348346Error responses include a JSON body with an error message:
349347
350- ``` json
348+ ``` json [json]
351349{
352350 "error" : " Bad Request" ,
353351 "message" : " Invalid data format"
0 commit comments