The "vars" argument to parse_as_rest() can include "offset" and "limit"
keys, which default to 0 and 1000, respectively.
If you want to return all records, you can add "limit" to the URL query
string:
/myapp/controller/api?limit=[very large number]
or just update the "vars" dictionary within the GET() function:
vars.update(limit=[very large number])
Anthony
On Thursday, March 8, 2018 at 11:00:11 AM UTC-5, Arve Lømsland wrote:
>
> I am using web2py as REST api. The db contains of 4911 records.
> When we request all records with .../default/api/Employee.json it only
> returns 1000 records.
> I cant understand what is wrong? Is there a limit somewhere in DAL or in
> the json output?
> If i select with shell db_visma(db_visma.Employee).select() it returns all
> 4911 records.
>
> @auth.requires_login()
> @request.restful()
> def api():
> response.view = 'generic.' + request.extension
>
> def GET(*args, **vars):
> patterns = [
> '/Employee[Employee]',
> '/Employee/{Employee.EmpNo}',
> '/WgEmp[WgEmp]',
> '/WgEmp/{WgEmp.EmpNo}',
> '/Department[R1]',
> '/CountryCode[CountryCodes]'
> ]
> parser = visma_db.parse_as_rest(patterns, args, vars)
> if parser.status == 200:
> return dict(Response=parser.response)
> else:
> raise HTTP(parser.status, parser.error)
> return locals()
>
>
> visma_db.define_table('Employee',
> Field('FirstName'),
> Field('LastName'),
> Field('EmpNo', writable=False),
> Field('Phone'),
> Field('Ad1'),
> Field('PArea'),
> Field('PNo'),
> Field('CountryCode'),
> Field('BGiro'),
> Field('R1'),
> Field('LastUpdate'),
> primarykey=['EmpNo'],
> rname='[VLData].[VLData].[Employee]',
> migrate=False)
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.