Designing for Non Transactional calls

By | July 21, 2014

One of the key aspects when making API calls is to keep them as simple as possible. This means if you are an API consumer, you want to be able to retrieve data on demand and not have to worry about how many times you have retrieved it, or that you have to retrieve it between a certain period of time.

Take for example retrieving sales data from a financial application. You want to design your integration to retrieve all the sales for the current day instead of retrieving all the individual sales for the day and then adding them together.

The reasons are obvious. What if you retrieve the same sales more than once. What happens if you miss a sales. What happens if your logic adds them incorrectly? What about rounding errors? You want the API to do the work for you.

Flipping this on it’s head, if you are an API provider you want to provide this summary capability to your user so they don’t have to try and pull out every single transaction.

Sometimes there maybe valid requirements to analyze data on an individual sale basis. An example would be if you wanted to track sales within a very short time period, such as on an hourly basis. This requirement needs to be thought through carefully and designed with the right purpose in mind.

Leave a Reply

Your email address will not be published. Required fields are marked *