Configuring rate limit for APIs

Rate limit is the number of API calls a user can make during a time period. When a rate limit is reached, the API returns 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.

About this task

You can specify a rate limit to a list of APIs.

Procedure

  1. Go to the location InstallDir/DeveloperPortal/configuration.
  2. Open the dpo_wrapper.conf file to edit the same.
  3. Add the following entry to the 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 values for the following entries:
    • 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 APIs according to your requirements.
    • 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.

What to do next

  • You can edit the custom_wrapper.conf file to include more APIs or modify the specified number of invocations.