SQL over HTTP using JSON-RPC

144 views
Skip to first unread message

Raymund

unread,
Sep 2, 2019, 5:12:36 AM9/2/19
to JSON-RPC
Just like to share a project I am doing which would enable clients to send SQL statements over HTTP using JSON-RPC, with the SQL statement in the params member. For security, whitelist validation is done using a dictionary, and table/column field names conversion so not to expose real database table/column names.


Line 110 is where SQL can be prepared using PDO. Use '?' as placeholder and query_data inside params for values in array. Also, make sure to reflect 'result' => $mod_query in response object to reflect the right result variable.

I tried this and was able to make database queries using Postman.

Raymund

Raymund

unread,
Sep 2, 2019, 5:13:50 AM9/2/19
to JSON-RPC
Use the GET method to view the whitelist dictionary and the POST method to access the function itself.

Raymund

unread,
Oct 11, 2019, 1:43:04 AM10/11/19
to JSON-RPC
I have updated the code to reflect a working example of SQL over HTTP using JSON-RPC v2.0 format.


Is anyone working on the same functionality? Maybe using a different programming language?
Reply all
Reply to author
Forward
0 new messages