Jdbase Docs
JDbase Documentation
This document provides an overview of the JDbase API developed to interact with databases and manage users via HTTP requests.
Table of Contents
Introduction
API Endpoints
/api
/users
Introduction
The JDBase API is designed to facilitate database operations and user management through HTTP requests. It offers endpoints for executing CRUD (Create, Read, Update, Delete) operations on databases, as well as for creating and managing users.
API Endpoints
/api
Endpoint
/api
EndpointPOST /api
This endpoint is used for executing CRUD operations on databases. It requires an API key provided in the request header for authentication and authorization.
Type: POST
Request Headers:
api_key
: The API key for authentication.Request Body:
db
: The name of the database.query
: The query to be executed.type
: The type of operation (create
,read
,update
,delete
,match
).update_query
(optional): The query for updating records (required for update operation).Response:
Success: JSON response with the result of the operation and HTTP status code 200.
Error: JSON response with error message and corresponding HTTP status code (401, 403, 400, 404, 500).
Supported Operations:
Create: Add new records to the database.
Read: Retrieve records from the database.
Update: Modify existing records in the database.
Delete: Remove records from the database.
Match: Check if records match specified criteria.
POST /users
/users
This endpoint is used for creating users with specific permissions. It also requires an API key provided in the request header for authentication and authorization.
Type: POST
Request Headers:
api_key
: The API key for authentication.Request Body:
name
: The name of the user.permission
: The permissions assigned to the user (create
,read
,update
,delete
).Response:
Success: JSON response with a message confirming user creation and the generated API key, along with HTTP status code 200.
Error: JSON response with error message and corresponding HTTP status code (401, 403, 400).
Supported Operations
Create: Add new records to the database.
Read: Retrieve records from the database.
Update: Modify existing records in the database.
Delete: Remove records from the database.
Match: Check if records match specified criteria.
Example :
Default api key is "adminkey" you can change this editng config/apis.json
Create:
Read:
Update:
Delete:
Match:
Create_user:
Create Database:
For any other unexpected errors, the API returns a generic "Internal Error" message with HTTP status code 500.
Happy Development
Last updated