Configure API Performance Settings
There are a number of configuration settings for the API that are designed to ensure it can perform well. In most cases the default settings will be suitable, but you may wish to adjust the settings to suit your requirements.
Rate Limit
Access to the Open Data API is subject to rate limiting: any user who submits too many requests within a short period of time will be unable to submit further requests until their limit resets. This is to ensure that the API performs well for all users and that it is not possible for a single application to overload the server.
There are three individual rate limit settings:
- A global setting that applies to all endpoints.
- A rate limit for the
/schema
endpoint. - A rate limit for the
/table
endpoint.
If you do not want to apply any rate limits, you can set one or more of these to -1
. Otherwise, set them to the number of requests you want to allow per hour from a particular API key.
If multiple limits apply to a given query (for example, you have set different values for the global rate limit and the table rate limit) then a request will be limited as soon as the lower of the two limits is reached.
To change the limits, you need to edit the settings in the Open Data API's configuration.properties file:
Open the configuration file in a text editor. It is located at <tomcat_home>\webapps\webapi#rest#v1\WEB-INF\classes\configuration.properties
The Open Data API has its own copy of this configuration file. You must make the change in this file, not the equivalent file in the SuperWEB2 directory.
Locate the following settings:
CODEopenDataApi.rateLimit.global=
CODEopenDataApi.rateLimit.schema=
CODEopenDataApi.rateLimit.table=100
Change the settings to your preferred number of allowed requests per hour. For example, to allow each API key to make 200 requests per hour, change it to the following:
CODEopenDataApi.rateLimit.table=200
- Save your changes, and restart Tomcat.
Pagination
If a request to the /schema
endpoint returns a large number of results, it will be split into pages. Each page of results contains a link to the next set of results.
By default, the threshold for pagination is 100 results, but you can adjust this by changing the openDataApi.schema.pageSize
in the Open Data API's configuration.properties file:
Open the configuration file in a text editor. It is located at <tomcat_home>\webapps\webapi#rest#v1\WEB-INF\classes\configuration.properties
The Open Data API has its own copy of this configuration file. You must make the change in this file, not the equivalent file in the SuperWEB2 directory.
Locate the following setting:
CODEopenDataApi.schema.pageSize=
Change the setting to your preferred page size. For example, to allow up to 200 results before pagination, change it to the following:
CODEopenDataApi.schema.pageSize=200
- Save your changes, and restart Tomcat.
Maximum Request and Response Limits
The API also has limits on:
- The maximum number of cells that can be returned to a client.
- The maximum number of field ietms that a user can query against.
These limits are designed to prevent very large tables from being generated, as there is a risk these might overwhelm the server.
By default, up to 1,000,000 cells can be requested, and up to 1,000,000 field items can be queried against. If you need to adjust these settings, you can do so by editing the following section of the Open Data API's configuration.properties file:
#================================================================================================================
# OPEN DATA API - TABLE
#================================================================================================================
# Integer. Default 1,000,000
# Maximum number of cells that can be returned to a client via the table API.
# Use this limit to prevent excessively large tables from being sent to the client.
openDataApi.table.maximumResponseCellLimit=
# Integer. Default 1,000,000
# Maximum number of field items a user can query against the table API.
# Use this limit to prevent clients from overwhelming the server with large requests.
openDataApi.table.maximumRequestItemLimit=
After making your changes, you will need to restart Tomcat to apply the changes.