How To Use
The Machbase RESTful API can be used in conjunction with the MWA server configuration. When using the RESTful API, specify the server ID or Server name to use as the 's' parameter.
ex) The following example sends the query to the server whose ID is 3 (or server name is sample_server) among the servers set in MWA and receives the result
If it can not find the ID or name of the specified server, it returns the following json with a 404 error.
The default URL for the Restful API is:
http://hostname: port can be found by running the MWAserver start command to run MWA with the url to connect to the MWA.
Retrieves the data using the HTTP GET method. The return value is a json type. You can pass the query statement you want to execute using the 'q' parameter. The query below brings up a list of tables.
You can use the HTTP POST method to send the input value of the json type as a parameter. Below is an example of entering data into a test_table with three columns.
First, we execute a query that creates a table using the curl GET method.
Enter data using the POST method using the curl command. The data input json can use four keys, and the 'name' and 'values' keys must be entered.
Input table name
Input data to be input as a 2-dimensional array
Date format to be used
If data type is used
Server ID or name
Server defined in MWA
If you enter a date type, you must specify the date format. The date format must use the pattern used in Machbase. If not specified otherwise, YYYY-MM-DD is set to HH24: MI: SS mmm: uuu: nnn Machbase default format and the result value will not be returned properly if date format is not correct. When specifying date and time pattern, you should be careful of case sensitive.
Standard RESTful APIs should use the HTTP DELETE method, but Machbase methods use the HTTP GET Method to send a delete query. Below is an example of deleting data from test_table.
Creating, Altering, and Dropping Table
In Machbase, any query can be performed using the HTTP GET method. Therefore, the TABLE CREATE, ALTER, and DROP commands are also available.