I need to expose an API A which internally uses another API B. API B accepts an array of product codes and returns their information. That array could have any length but API B will return information of only first 10 product codes and silently discard the rest, i.e. doesn't throw an exception or return an error.

Now while designing API A, how should I go about it? Should I also discard the extra elements silently or throw an exception or return partial information with an error?

I can also split the input in batches and call API B multiple times from API A but each call to API B has to wait for 1 second.

  • 2
    What do the clients of API A want? Correct but slow behavior, silent wrong behavior, or an error suggesting they try a smaller query? And maybe there's other choices, if implementation A caches some of API B's results.
    – Erik Eidt
    Commented Oct 15, 2016 at 22:12
  • 2
    I wish my customers thought defective code was good. I'd be thought a genius and get a pay raise.
    – radarbob
    Commented Oct 16, 2016 at 3:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.