I agree with you, and to be honest this is what bothers me the most in the current state of the project. The top point in the list of TODO/IDEAS is currently “Add better support for PUT, DELETE, HEAD, OPTIONS? How? For which commands?”.
I'd be very glad to hear about a better way to implement this. As antirez (author of Redis) and kbd pointed out, Redis supports a lot more than GET/SET. How do I make LPUSH/RPUSH/SADD... RESTful?
[1] For example, cross-domain JavaScript requests can only read GET responses.
I have started to implement Cross-Origin Resource Sharing, which should enable cross-domain JS requests using POST (If I understood correctly). An OPTIONS call is made by the client before the POST.
Type operations:
POST /list?key=<key>&value=<value> -> LPUSH
DELETE /list?timeout=<timeout>&key[0]=<key>&key[1]=<key> -> BLPOP
List operations:
POST /list/<key>?value=<value> -> LPUSHX
DELETE /list/<key> -> LPOP
Search based operations:
POST /list/<key>?find=<value>&value=<value> -> LINSERT BEFORE
DELETE /list/<key>?find=<value>&count=<count> -> LREM
Index based operations:
GET /list/<key>/<index> -> LINDEX
GET /list/<key>/<index>?count=<count> -> LRANGE
PUT /list/<key>/<index>?value=<value> -> LSET
Transactional operations:
POST /list-tx/rpop/push?source=<key>&target=<key> -> RPOPLPUSH
POST /list-tx/rpop/push?timeout=<timeout>&source=<key>&target=<key> -> BRPOPLPUSH
Length
GET /list-length/<key> -> LLEN
Reverse operations:
POST /rlist?key=<key>&value=<value> -> RPUSH
POST /rlist/<key>?value=<value> -> RPUSHX
DELETE /rlist/<key> -> RPOP
POST /rlist/<key>?find=<value>&value=<value> -> LINSERT AFTER
DELETE /rlist?timeout=<timeout>&key[0]=<key>&key[1]=<key> -> BRPOP
Interesting take on it, your HTTP verbs seem to be pretty well used. I'm not sure that expressing commands with a query string would be very easy to remember though. The advantage of /COMMAND/ARG0/ARG1.../ARGN is that you can pretty much type a redis command like you do in telnet, replace spaces with slashes, and have an answer.
I also maintain the phpredis extension for PHP, and having method names that differed from Redis command names has annoyed people a lot (e.g. lGetRange instead of LRANGE). phpredis now has method aliases with the same name as the underlying Redis command so that users don't have to go back to the documentation all the time.
Some people mentioned that GET should always be usable for Javascript apps. It could be interesting to create a list of commands with their respective verb recommendations, and send that recommendation with the response. A strict mode could also for the right verb and disable write commands with GET requests.
Thanks for those suggestions!
Keeping the Redis names means REST isn't even an option. There's no way around that. For instance LINDEX and LSET operate on the same resource, i.e. the same URL. Giving them different URLs means abandoning any and all RESTfulness.
This exercise was probably only useful in showing that REST is not what you want, but it was interesting to think about. Thanks for the question!
In other words, this has nothing to do with "the amount of operations you can do with rest", this has to do with not being able to use the limited number of HTTP verbs to correspond to the multitude of Redis commands.