@endpoint(u'/interface-data/get-books', postprocess=json)
def get_books(ctx, rd):
 (library_id, db, sorts, orders) = get_basic_query_data(ctx, rd)
 try:
  num = int(rd.query.get(u'num', DEFAULT_NUMBER_OF_BOOKS))
 except Exception:
  raise HTTPNotFound((u'Invalid number of books: %r' % rd.query.get(u'num')))
 searchq = rd.query.get(u'search', u'')
 db = get_library_data(ctx, rd)[0]
 ans = {}
 mdata = ans[u'metadata'] = {}
 with db.safe_read_lock:
  try:
   ans[u'search_result'] = search_result(ctx, rd, db, searchq, num, 0, u','.join(sorts), u','.join(orders))
  except ParseException as err:
   raise HTTPBadRequest((u'Invalid search expression: %s' % as_unicode(err)))
  for book_id in ans[u'search_result'][u'book_ids']:
   data = book_as_json(db, book_id)
   if (data is not None):
    mdata[book_id] = data
 return ans

@ endpoint ( u'/interface-data/get-books' , postprocess = json ) def get_books ( ctx , rd ) : ( library_id , db , sorts , orders ) = get_basic_query_data ( ctx , rd ) try : num = int ( rd . query . get ( u'num' , DEFAULT_NUMBER_OF_BOOKS ) ) except Exception : raise HTTPNotFound ( ( u'Invalid number of books: %r' % rd . query . get ( u'num' ) ) ) searchq = rd . query . get ( u'search' , u'' ) db = get_library_data ( ctx , rd ) [ 0 ] ans = { } mdata = ans [ u'metadata' ] = { } with db . safe_read_lock : try : ans [ u'search_result' ] = search_result ( ctx , rd , db , searchq , num , 0 , u',' . join ( sorts ) , u',' . join ( orders ) ) except ParseException as err : raise HTTPBadRequest ( ( u'Invalid search expression: %s' % as_unicode ( err ) ) ) for book_id in ans [ u'search_result' ] [ u'book_ids' ] : data = book_as_json ( db , book_id ) if ( data is not None ) : mdata [ book_id ] = data return ans
get books for the specified query optional: ?library_id=<default library>&num=50&sort=timestamp .