mercredi 18 septembre 2019

Is it a right design to support web api proxy code aggregation?

When we consume a Web API which follows swagger/open API spec, I can use visaul studio or swagger-codegen to generate a suite of proxy codes.

But say we have 30-40 apis in our site, and our customers need to call random amount of apis to get the needed data (one customer may call api 1,3 7 once and api 9 three times with different settings).

So ideally the proxy code should allow callers to aggregate different API calls together, and internally the proxy will fire async calls to our apis and return data together.

However, if we do go down that route, there are some complications I can think:

  1. error handling
  2. retry logic
  3. potential longer waiting time for customer (if our customer needs the data to render a website, the angular call will only return when all data is returned instead of returning at least some data)

So I am bit confused on if it is a right design choice at the moment. Is there a design pattern on this kind of scenario?

Aucun commentaire:

Enregistrer un commentaire