Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Question Evgeny Shvarov · Dec 8, 2020

REST API which accepts SQL and returns JSON

Hi folks!

Do we have an embedded REST API in IRIS which accepts arbitrary SQL and returns data in JSON?

Or if anyone did something like this?

The idea is to have something like MDX2JSON but SQL2JSON.

Thanks!

Comments

Anton Umnikov · Dec 8, 2020
s sc=##class(%ZEN.Auxiliary.jsonSQLProvider).%WriteJSONFromSQL("json","SELECT Name FROM Sample.Person")
0
Nicholai Mitchko  Dec 8, 2020 to Anton Umnikov

+1 didn't know this existed, incredibly helpful!

0
Andy Coutinho  Dec 9, 2020 to Anton Umnikov

Very nice! thanks for sharing

0
Evgeny Shvarov  Dec 13, 2020 to Anton Umnikov

Thanks, Anton!

I packed your answer in sql-res-api module.

if you zpm it, you have /sql rest which accepts SQL with POST request and returns JSON.

USER>zpm "install sql-rest-api"
0
Nigel Salm · Dec 18, 2020

Hi

I was going to offer to write such a function but it appears that other developers have already got solutions for your request. Pity, its a nice challenge

Nigel

0
Nigel Salm  Dec 18, 2020 to Evgeny Shvarov

Lol, I was so busy reading all the other posts otherwise I would have sat down and written it.

Would you like to share your code with me devil (*** please ***)

Nigel

0
Nigel Salm  Dec 19, 2020 to Evgeny Shvarov

Thank you Evgeny

0