Skip to content

Compare: RESTful Interface

Showing with 24 additions and 0 deletions.
  1. +24 −0 RESTful-Interface.md
View
24 RESTful-Interface.md
@@ -20,6 +20,30 @@ The params are passed to the query as normal URL parameters e.g.
?firstparam="hello"&secondparam="world"&...
+If a parameter can have many values is will be turned into a comma separated "SQL escaped" list, that can be used for the SQL "IN" operator e.g.
+
+ ?manyparam="1"&manyparam="2"&manyparam="3"&...
+
+Would become:
+
+ 1,2,3
+
+To be used in a SQL statement like:
+
+ ... #{column} IN [@{manyparam}]
+
+which would expand to:
+
+ ... "column" IN [1,2,3]
+
+If the multi param is quoted, then the individual values of the list will be quoted:
+
+ ... #{column} IN ['@{manyparam}']
+
+would expand to:
+
+ ... "column" IN ['1','2','3']
+
For the named queries (resources - which should only use GSQL) need to make sure that select, update, insert, and delete statements get the correct HTTP verb, so you can't do a PUT select statement. Perhaps make the first word in a named query define the HTTP verb - select (GET), insert (POST), update (PUT), and delete (DELETE) - so a select with a PUT verb would be rejected. Perhaps have the capitalised HTTP verb the first word of the GSQL rather than the actual sql, further selects etc. within the GSQL would use the normal word. Actually why not have the HTTP verb as the key for the query, and remove the first word (select, update, insert, delete) from the GSQL.
E.g.
Something went wrong with that request. Please try again.