Hi All,
I’m working on doing a sample minimalist CGI Web API program that uses no external API stack other than what the OS provides along with SQL in an RPGLE program.
I essentially want to see what a lightweight RPG CGI REST architecture might be in today’s arena.
I know there are frameworks like IWS, HTTPAPI, YAJL and NOXDB, CGIDEV2 etc that can be used as helpers.
I also know I can use Python, PHP, Node, Java etc. I want this ONLY to be SQLRPGLE.
This is a POC to see if I can do a minimalist approach to CGI. And even AI keeps screwing things up as far as appropriate API definitions and data conversion :-)
The biggest issue is handling the UTF-8 data conversion.
Also for context it’s been a few years since I’ve worked much with RPGLE and CGI. And I’m going all in on SQLRPGLE and JSON_TABLE/JSON_OBJECT with this sample.
Basically I want to:
-Take in a posted JSON packet. (Works)
-Read the request data QtmhRdStdIn. (Works but it appears to be raw UTF-8 data. I think)
-Convert and review the URL data and JSON and convert it to something readable in RPGLE as it appears to be coming in as UTF-8.
-Run an SQL using JSON values extracted from the JSON request using JSON_TABLE.
-Run the SQL query.
-Turn around and output the results as JSON
My only real stumbling block is converting the incoming and outgoing data correctly from and back to UTF-8. And that may also be an Apache configuration issue as far as character conversion. ICONV may be part of the answer but even AI comes up with long answers that didn’t seem to work as I had to use the 80/20 where it gave me 80% and I had to punt on the 20%.
Anyway, any insights relevant to the constraints I laid out are appreciated in case anyone else has already been there when playing with SQLRPGLE, CGI and JSON.
Regards,
Richard Schoen
Web:
http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx