Configuring rate limit for APIs

About this task

Rate limit is the number of API calls a user can make during a given time period. Once a rate limit is reached, the API will return an error code until the specified rate limit time frame resets. Rate limit helps to avoid overloading the backend service and their infrastructure and to limit the specific clients in terms of resource usage and so on.

Developer Portal allows you to specify rate limit to the list of required APIs.

To configure the rate limit for APIs

  1. Navigate to the location, SAGInstallDir/DeveloperPortal/configuration.
  2. Open the dpo_wrapper.conf file to edit the same.
  3. Add the following to file:
    wrapper.java.additional.2011=-Dportal.server.config.enable-rate-limiting=
    wrapper.java.additional.2012=-Dportal.server.config.rate-per-minute=
    wrapper.java.additional.2013=-Dportal.server.config.rate-limited-apis=
  4. Provide the required values in:
    • Dportal.server.config.enable-rate-limiting. Provide true to enable rate limit for APIs.
    • Dportal.server.config.rate-per-minute. Provide the number of invocations that you want to allow per minute for the given APIs.
    • Dportal.server.config.rate-limited-apis. Provide the list of APIs, separated by commas, that you want to configure rate limit.
    Sample values:
    wrapper.java.additional.2011=-Dportal.server.config.enable-rate-limiting=true
    wrapper.java.additional.2012=-Dportal.server.config.rate-per-minute=3
    wrapper.java.additional.2013=-Dportal.server.config.rate-limited-apis=/rest/v1/signup,/rest/v1/forgotpassword
  5. Save the changes.

Next steps:

  • You can edit the dpo_wrapper.conf file to include more APIs or modify the specified the number of invocations, when required.