[Retrospective](EN) Be careful about response max item size when using API call

Retrospective about what happened when calling API


Environment and Prerequisite

  • API Call Experience


What I experienced when calling API

There was a code worked well. It was a code that filtering what we wanted after get the result of API. However one day it did not work in one of our services. After take a looking it, we found that there were values what we wanted on web but those values were not exist after filtering. I looked into it long time but I thought there was no problem. However there was a problem with the code. It wasn’t the code’s fault, it was developer’s fault!

With help of my colleague, we inspired by API response result item size before filtering. Its size was a multiple of 5 or 10. We found that there was a limit of API response item size. That was why we could not get the values what we wanted. In my code, we received the response items and filtered it but there was a max limit on item size. So we could not get what we wanted. Problem was max item size in API call.

Let’s suppose expected value is the 101st but API result contain only until 100th value so we cannot get the expected 101st value.

At last we add conditions to API call and add pagination code to API call to solve above issue.

I learned three things.

  1. To minimize burden and mistake of API caller, add conditions to API call rather than get all response items.
  2. Be careful when use API call because there can be a limit of response item size.
  3. Solving problems together can make solving issue faster.

It was a simple thing but I took some time to solve it. So I wrote a post about it.

Be careful next time!


Reference