Actions
Feature #33526
closedAdd possibility to configure limit used to retrieve objects for an API response
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Duplicate
Description
In file app/controllers/application_controller.rb:
  # Returns offset and limit used to retrieve objects
  # for an API response based on offset, limit and page parameters
  def api_offset_and_limit(options=params)
    if options[:offset].present?
      offset = options[:offset].to_i
      if offset < 0
        offset = 0
      end
    end
    limit = options[:limit].to_i
    if limit < 1
      limit = 25
    elsif limit > 100
      limit = 100
    end
    if offset.nil? && options[:page].present?
      offset = (options[:page].to_i - 1) * limit
      offset = 0 if offset < 0
    end
    offset ||= 0
    [offset, limit]
  end
The value of the limit is hardcoded to 100.
It's very long to get for example 20000 objects - 200 requests in ~3 minutes. But it's faster with hardcoded limit 10000 - ~20 seconds only.
Please, add possibility to configure limit used to retrieve objects for an API response.
Thanks!
Related issues
       Updated by Mischa The Evil over 5 years ago
      Updated by Mischa The Evil over 5 years ago
      
    
    - Is duplicate of Patch #16069: Allow configuration of API limit instead of hardcoding at 100 added
       Updated by Mischa The Evil over 5 years ago
      Updated by Mischa The Evil over 5 years ago
      
    
    - Status changed from New to Closed
- Resolution set to Duplicate
Closing as a duplicate of #16069.
Actions