3 Problems to Watch Out for When Using a Multifunctional API
A multifunctional API can perform multiple tasks within one request, simplifying things for the end user. When the Cloud Elements Documents Hub API was first designed, developers wanted ensure that it was multifunctional. In choosing to provide a multifunctional API, however, understanding the API’s full performance is lost. The end user is no longer able to self-diagnose issues with the API because there are multiple requests bundled together. It’s important for a developer to understand these considerations when writing to a multifunctional API in order to avoid issues and confusion.
The following is a list of common issues that arise as a result of integrating with a multifunctional API:
1. Specifying parameters affects performance: When using the Documents Hub API to copy a file, the performance on the API depends on the arguments the user provides. In this example, we need to find out if the folder we want to copy to exists. If it doesn’t, the folder must be created which is one API call. Then the file needs to be copied to the new folder and renamed to the new name. The user needs to be aware that 3 different API calls have been made.
2. API Rate Limits: Provider APIs have rate limits so that a user can only execute a limited number of requests before the API will shut you out. This happens to ensure the API remains secure and is performing correctly. The rate limits prevent denial DoS attacks and other potential issues. There is no way to predict the number of requests that will be serviced before a rate limit is hit, but users need to be aware that it can happen and that your code should handle it gracefully. Users must be mindful that it is bad if rate limit errors are being received often.
Reasons rate limits are reached:
Repeatedly retrying API calls
Polling for changes
3. Giving users the choice to either have path based or ID based operations: Giving users this choice allows for flexibility, but limits the performance of the API in some cases. In the Documents Hub, OneDrive has ID based operations and Dropbox has path based operations. Users that are using path based operations in OneDrive may not be aware that all of the paths need to be converted to IDs. The picture below shows operations on deeply nested folders. For each of the folders we must look up the folder’s contents in order to get the IDs of the next level. With this, the API’s performance will be less efficient. Being aware of the type of operation will save time and improve efficiency.
We are constantly looking for ways to simplify usage and increase the success rate of our APIs. As developers, we have to be vigilant about the performance of the API, but the customer also needs to be aware of how to make their own code work best with the APIs that are delivered to them.
Check out other recent posts from Cloud Elements developers:
- Using OAuth with Service Endpoints
- Cloud File Sharing: 3 Use Cases For Managing Access Permissions with Box, Dropbox and Google Drive
Find out more about our Documents Hub API.