Continuing from our previous post on mutable tables, Introducing MTable, we now see how we can interact with this data abstraction through REST API’s.
The Ampool developer REST interface runs as an embedded HTTP or HTTPS service (Jetty server) within an Ampool ADS server. For the purpose of documentation, the developer REST API’s are also integrated with the Swagger™ framework. This framework provides a browser-based test client that allows you to visualize and try out the REST APIs before you use in your application. Swagger application JARs are included in the Ampool ADS distribution so you do not need to install any additional libraries to use it.
The Ampool MTable REST APIs allow you to to do multiple operations on MTable like create, delete, insert, scan, list and count operations. Following is the complete list of operations using these APIs:
For more details about these REST end-points, please check the online docs to understand how to enable and work with it. Once you start the Ampool ADS server with REST enabled, the Swagger UI will be rendered on port 8080 (by default) on the host machine.
The Swagger UI can be used to perform MTable operations using REST endpoints. The picture below displays MTable PUT operation from the Swagger UI. A sample record is inserted into an MTable against key 9.
The REST APIs can also be accessed via the command-line using a client, such as curl. The example below shows how it uses the MTable get REST endpoint to fetch the record inserted from the Swagger UI:
So, try interacting with MTables the REST way and post any questions or suggestions that you may have.