HTTP Interface
The HTTP interface lets you use JoinBase on any platform from any programming language in a form of REST API.
🔍
All TCP based interfaces supports two modes: plain or TLS, plain is ok for . But, generally, the TLS interface is recommended for production.
Primary
- Query (Data Reading)
GET / or /?param1=a&param2=2...
[body: select/show/desc statement]
The path of a query must be "/". The parameters are optional. Now we support the following parameters: database, output_layout and output_format, username, password.
Parameters | MQTT Message |
---|---|
database | the name of database. default value: default, allowed values: n/a |
output_layout | the memory layout of output. default value: rowwise allowed values:rowwise,columnwise |
output_format | the memory layout of output. default value: rowwise allowed values:json,csv |
username/password | the username/password for authentication. (We do not recommend using this method as the parameter might be logged by web proxy and cached in the browser) |
- Data ingestion (Data Writing)
POST /database/table
[body: csv or json payload]
The path of a query must be a valid topic or topic alias.
- DDL(Data Definition Language)/Schema Change
See more in the document of advanced features.
- Authentication
The two simple authentication methods in the HTTP interface are supported:
a. Using ‘X-JoinBase-User’ and ‘X-JoinBase-Key’ headers. Example:
b. In the ‘user’ and ‘password’ URL parameters. (We do not recommend using this method as the parameter might be logged by web proxy and cached in the browser).
🔍
The security philosophy of JoinBase is whitelist-based. So the authentication is the must in any interface.
Examples
- Query
curl -s -H 'X-JoinBase-User: abc' -H 'X-JoinBase-Key: abc' -X GET 'http://127.0.0.1:8080/' -d 'select 123'|json_pp
- Desc table
curl -s -H 'X-JoinBase-User: abc' -H 'X-JoinBase-Key: abc' -X GET 'http://127.0.0.1:8080/?database=abc' -d 'desc table t'|json_pp
- Ingest data
curl -s -H 'X-JoinBase-User: abc' -H 'X-JoinBase-Key: abc' -X POST 'http://127.0.0.1:8080/abc/t' -d '3,4
5,6'
Predefined Query
See more in the document of advanced features.