At AppFirst one of our biggest features is our extensive public API system. Using our many UI components, such as the Dashboard or Correlate, we try to cater an intuitive experience for our users but we understand that the UX we have established may not be as flexible as you need it. This is why we decided to expose all of the data so our users have the option to manipulate it themselves.
Unfortunately with this amount of freedom comes the risk of users abusing it (usually unintentionally). Prior to the release of API v4, our API system did not set limits on the parameters coming in, so a customer could potentially ask for a years worth of summary data resulting in hundreds of megabytes worth of data (and yes, we have seen it happen). This led to ridiculously long http requests/responses, confusion from the user, and in some extreme cases system failure.
To resolve this issue we introduce two forms of pagination: offset and cursor-based. The type of pagination used is dependent on the type of API call that the user makes and further details can be found here. Pagination benefits our customers and us at AppFirst in several ways.
- Protects users from accidentally querying for data across large time spans. Let’s look at the aforementioned example. If that same user requests for a years worth of data again he would instead get small subset of the total data requested as well as the URL to get the next subset of data. This is much favorable to one giant query that would leave the user waiting for several minutes while half a million data points were organized into a single JSON object.
- Gives the users more control in how much data they require. This is especially true for any offset pagination API calls (i.e. https://wwws.appfirst.com/api/servers/). The new data format of v4 also makes it easier to request for any previous or next page since we provide the URLs directly in the response.
- Prevents AppFirst system failures against malicious API abusers. More uptime means more happy users.
We’re excited to see how our customers make use of the new v4 API calls and, as always, feel free to comment below or contact us directly if you have any questions.