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
Merge pull request #914 from mzazrivec/fix_api_limit_and_offset

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