Skip to main content

Microservice to deploy Beardb Secured Databases Remotely.

Project description

BearDB MicroService

beardbimg

A microservice using the Beardb database system is a standalone service that is designed to deploy JSON databases remotely and provide API endpoints for accessing the data stored in these databases. This microservice utilizes the Beardb database system, which is a highly scalable and flexible database management system that is specifically designed to handle large amounts of data in the form of JSON documents.

The microservice provides a set of API endpoints that allow users to retrieve data from the JSON databases that are deployed on the server. These API endpoints can be accessed using HTTP POST requests, and they return data in the form of JSON objects. This allows users to easily access and manipulate the data stored in the databases, and it also enables them to integrate the microservice with other systems and applications.

Introduction

Install Libaries

$ python3 -m pip install BeardbAPI 
$ python3 -m pip install gunicorn

Import Libraries

from BeardbAPI.API import BeardbAPI

Running the Development MicroService

run.py

test = BeardbAPI()
test.run(host='127.0.0.1',port=5555)

Terminal

$ python3 run.py

Running the Production MicroService

run.py

test = BeardbAPI()
api = test.service()

Terminal

$ gunicorn run:api

The file system automatically starts the database environment in the current directory of the driver code. To avoid that pass in the directory you want to make the database enviroment. Run the following code

test.storage(app_name='test_app',dir='')

Optimal Driver Code (Development)

run.py

test = BeardbAPI()
test.storage(app_name='test_app',dir='')
test.run(host='127.0.0.1',port=5555)

Terminal

$ python3 run.py

Optimal Driver Code (Production)

run.py

test = BeardbAPI()
test.storage(app_name='test_app',dir='')
api = test.service()

Terminal

$ gunicorn run:api

API Documentation

API Endpoints

[POST] - \me
[POST] - \newuser
[POST] - \newproject
[POST] - \newdatabase
[POST] - \newbucket
[POST] - \insertdata
[POST] - \fetchdata
[POST] - \fetchbyid
[POST] - \updatebyid
[POST] - \updatedata
[POST] - \deletedata
[POST] - \deletebyid
[POST] - \getbuckets
[POST] - \getdatabases
[POST] - \getprojects

API QuickStart

To access any of the endpoint you have to include your email and secret in the body of the API Request.

{
"email":"teddyoweh@gmail.com"
"secret":"a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
}

You can get you secret by creating a new user, steps to do so is listed in the API GUIDES Below All of the endpoints require only a POST Method

API GUIDES

Headers

Server: gunicorn
Date: Wed, 14 Dec 2022 08:11:34 GMT
Connection: close
Content-Type: application/json
Content-Length: 582
Access-Control-Allow-Origin: *

Create New User

Body

  • email
  • fullname
  • password

Method

POST

Endpoint

\newuser

Response

 

{
 "status": "success"
	"data": {
 
 	   "email": "teddyoweh@gmail.com",
           "fullname": "testt",
           "id": "db067f2a-7ac4-11ed-aaf7-324d38bf6d76",
           "password": "tstt",
           "secretKey": "a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
           "databases": [
              {
               "name": "appp",
               "project": "idea"
              }
           ],

           "projects": [
             "idea"
           ],
           "buckets": [
             {
              "database": "appp",
              "modified": "2022-12-13 03:47:55.373527",
              "name": "users",
              "project": "idea"
             },
            ]
            "created": "2022-12-13 03:02:22.519349",

          },

}

Get User Data

Body

  • email
  • secret

Method

POST

Endpoint

\me

Response

 

{
 "status": "success"
	"data": {
 
 	   "email": "teddyoweh@gmail.com",
           "fullname": "testt",
           "id": "db067f2a-7ac4-11ed-aaf7-324d38bf6d76",
           "password": "tstt",
           "secretKey": "a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
           "databases": [
              {
               "name": "appp",
               "project": "idea"
              }
           ],

           "projects": [
             "idea"
           ],
           "buckets": [
             {
              "database": "appp",
              "modified": "2022-12-13 03:47:55.373527",
              "name": "users",
              "project": "idea"
             },
            ]
            "created": "2022-12-13 03:02:22.519349",

          },

}

Create Project

Body

  • email
  • secret
  • project

Method

POST

Endpoint

\newproject

Response

{
 "status": "success"	
}

Create Database

Body

  • email
  • secret
  • project
  • database

Method

POST

Endpoint

\newdatabase

Response

{
 "status": "success"	
}

Create Bucket

Body

  • email
  • secret
  • project
  • database
  • bucket

Method

POST

Endpoint

\newbucket

Response

{
 "status": "success"	
}

Insert Data

Body

  • email
  • secret
  • project
  • database
  • bucket
  • data

JSON FORMAT FOR Data

"{'name':'teddy'}"

Method

POST

Endpoint

\insertdata

Response

{
 "status": "success"	
}

Update Data With Query

Body

  • email
  • secret
  • project
  • database
  • bucket
  • data
  • query

JSON FORMAT FOR Data & Query

"{'name':'teddy'}"

Method

POST

Endpoint

\updatedata

Response

{
 "status": "success"	
}

Update Data With ID

Body

  • email
  • secret
  • project
  • database
  • bucket
  • data
  • id

JSON FORMAT FOR Data

"{'name':'teddy'}"

Method

POST

Endpoint

\updatedata

Response

{
 "status": "success"	
}

Fetch Data With Query

Body

  • email
  • secret
  • project
  • database
  • bucket
  • query

JSON FORMAT FOR Query

"{'name':'teddy'}"

Method

POST

Endpoint

\updatedata

Response

{
"data": {
	"id": "c0c5cc02-7ac8-11ed-a31f-324d38bf6d76",
	"name": "teddy"
},
"status": "success"
}

Fetch Data With ID

Body

  • email
  • secret
  • project
  • database
  • bucket
  • id

Method

POST

Endpoint

\fetchbyid

Response

{
"data": {
	"id": "c0c5cc02-7ac8-11ed-a31f-324d38bf6d76",
	"name": "teddy"
},
"status": "success"
}

Delete Data With Query

Body

  • email
  • secret
  • project
  • database
  • bucket
  • query

JSON FORMAT FOR Data & Query

"{'name':'teddy'}"

Method

POST

Endpoint

\updatedata

Response

{
 "status": "success"	
}

Delete Data With ID

Body

  • email
  • secret
  • project
  • database
  • bucket
  • id

Method

POST

Endpoint

\updatedata

Response

{
 "status": "success"	
}

Get Projects

Body

  • email
  • secret

Method

POST

Endpoint

\getprojects

Response

 

{
 "status": "success"
	"data": {
           "projects": [
             "idea"
           ],
          },

}

Get Databases

Body

  • email
  • secret

Method

POST

Endpoint

\getdatabases

Response

 

{
 "status": "success"
	"data": {
          "databases": [
		{
		"name": "appp",
		"project": "idea"
		}
               ],
          },

}

Get Buckets

Body

  • email
  • secret

Method

POST

Endpoint

\getbuckets

Response

 

{
 "status": "success"
	"data": {
           "buckets": {
			"database": "appp",
			"modified": "2022-12-14 00:55:30.617538",
			"name": "users",
			"project": "idea"
		},
          },

}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BeardbAPI-0.0.3.tar.gz (8.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page