RESTful API Demo Set Up
RESTful API is a modern feature of the RDM 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.
- Install an RDM Enterprise package (RESTful API feature is not included in the RDM Core package).
- Install Python (see Python downloads)
- Install the required Python module dependencies:
$ pip install Flask $ pip install requests
- Create the BookStore database from the Bookstore SQL example (
- Navigate to the directory containing the bookStore database and run the
rdm-tfscommand to start the server.
- Next, find the
RESTBookstorefolder in the
GettingStarted/examplespath of the RDM install directory.
- In necessary, edit the
config.pyfile and change the TFS_URI variable to the host and port number of the running
rdm-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 (
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
To learn more about the RDM RESTful API, you can read more of our documentation here.
The admin dashboard that is provided will work universally for all RDM 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.