RESTful API Demo Set Up
RESTful API is a modern feature of the RaimaDB product. Major functionality like creating, reading, updating, and deleting (CRUD) data from a Raima database is all possible from the RESTful API. Along with the core CRUD features, a suite of admin level information, such as disk usage, memory usage, current users, etc. are all accessible through the API. Through the RESTful API, it is a simple task to create admin dashboards, GUI's, and web applications.
This tutorial will take you through getting the example web application up and running locally, and hopefully spark ideas on how to best setup your own dashboard or application. Also, feel free to use this dashboard in your own application.
Prerequisites
- Install a RaimaDB Enterprise package (RESTful API feature is not included in the RaimaDB Core package).
- Install Python (see Python downloads)
- Install the required Python module dependencies:
$ pip install Flask $ pip install requests
Setup
- Create the BookStore database from the Bookstore SQL example (
GettingStarted/examples/rdm_bookstore
). - Navigate to the directory containing the bookStore database and run the
rdm-tfs
command to start the server. - Next, find the
RESTBookstore
folder in theGettingStarted/examples
path of the RaimaDB install directory. - In necessary, edit the
config.py
file and change the TFS_URI variable to the host and port number of the runningrdm-tfs
(the default location will be the local machine and default port number, localhost:21553 ).
class Config(object): """Set your URI here""" URI = "http://localhost:21553" class ProductionConfig(Config): pass
- Run the following command to start the demo:
$ python runserver
The command will display something similar to:
* Serving Flask app "RESTBookstore" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://localhost:5555/ (Press CTRL+C to quit)
- Start your local web browser with the URL displayed (
http://localhost:5555
).
More Information
You should now see the application running in your web browser. This is an example of what you might want to build to help you visualize important data from your Raima database or interact with it graphically.
Example Screen Shots
Query the Database
Example Dashboard
To learn more about the RaimaDB RESTful API, you can read more of our documentation here.
The admin dashboard that is provided will work universally for all RaimaDB databases. If you like how the dashboard looks and what data it is displaying, you can use this code for your own dashboard build-out or change it to fit your specifications.