Home Applications sql-rest-api

sql-rest-api

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
471
Views
34
IPM installs
4
2
Details
Releases
Reviews
Issues
Pull requests
Articles
Simple REST API web app which accepts SQL and returns the result in JSON

What's new in this version

Automatic version update

sql2json-rest-api

The app installs a /sql REST API web app which accepts SQL query with POST request on /sql/query endpoint and returns the result in JSON.

Installation with ZPM

zpm:USER>install sql-rest

Installation for development

Create your repository from template.

Clone/git pull the repo into any local directory e.g. like it is shown below (here I show all the examples related to this repository, but I assume you have your own derived from the template):

$ git clone git@github.com:evsharov/sql-rest-api.git

Open the terminal in this directory and run:

$ docker-compose up -d --build

or open the folder in VSCode and do the following:
rest

How to Work With it

This template creates /sql REST web-application on IRIS which accepts POST requests with SQL and returns results in JSON

Open http://localhost:52775/swagger-ui/index.html?url=http://localhost:52775/api/mgmnt/v1/USER/spec/sql to test the REST API

You can query any table in IRIS in the namespace.

e.g. you can test with Titanic data, which you have if you start docker.
if you installed with ZPM in a clear namespace you can import titanic data as:

USER>zpm “install csvgen”
USER>d ##class(community.csvgen).GenerateFromURL(“https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",",","Data.Titanic”)

And run query POST request as:
Screenshot 2020-12-12 at 23 52 40

and have the result as:
Screenshot 2020-12-12 at 23 54 36

Made with
Install
zpm install sql-rest download archive
Version
1.1.107 Nov, 2021
ObjectScript quality test
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS for Health
First published
12 Dec, 2020
Last checked by moderator
27 Jun, 2023Works