Project

General

Profile

Actions

Feature #33526

closed

Add possibility to configure limit used to retrieve objects for an API response

Added by VVD VVD over 4 years ago. Updated over 4 years ago.

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

Is duplicate of Redmine - Patch #16069: Allow configuration of API limit instead of hardcoding at 100New

Actions
Actions #1

Updated by Mischa The Evil over 4 years ago

  • Is duplicate of Patch #16069: Allow configuration of API limit instead of hardcoding at 100 added
Actions #2

Updated by Mischa The Evil over 4 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closing as a duplicate of #16069.

Actions #3

Updated by VVD VVD over 4 years ago

Didn't find it before create this issue.

Actions

Also available in: Atom PDF