JSON API config file #6
skylardarkfox
started this conversation in
Ideas
Replies: 1 comment
-
|
Any request would check this file first to determine the correct query to be run based on the path by which the API is accessed. These queries could either be defined directly in the JSON as shown, or a separate PHP include could be provided in which the query procedure is defined. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This could be an easy way to define an API structure, including a full path tree and database connection details. Such a file might be structured something like the following:
{ "connections":{ "Conn1":{ "host":"server1.com", "db":"someDatabase", "uid":"dbUser", "pwd":"dbPass", "server":"MySQL", "connection_type":"PDO", "options":[ ] }, "Conn2":{ "file":"connectionFile.php", "name":"thisConnection" } }, "endpoints":{ "level1":{ "__connection":"Conn2", "level1a":{ "select":{ "query":"SELECT ...", "connection":"Conn1", "procedure":"PreparedStatement" }, "insert":{ "query":"INSERT INTO ...", "connection":"Conn1", "procedure":"StatementSet" }, "update":{ "query":"UPDATE ...", "connection":"Conn1", "procedure":"StatementSet" }, "delete":{ "query":"DELETE FROM ...", "connection":"Conn1", "procedure":"PreparedStatement" } }, "level1b":{ "request":"path/to/file.php" } } } }Beta Was this translation helpful? Give feedback.
All reactions