Rest API: fix "limit" and "offset" functionality

This is to fix the followig errors:
1. When using 'limit' argument:

    String can't be coerced into Fixnum, klass:TypeError

2. When using 'limit' with the 'offset' argument:

    undefined method `-' for ...:String, klass:NoMethodError