iosrestmobileapi-design

Mobile API design - flexibility vs performance


I work for a startup where we have an iOS product that interfaces with a backend API. Initially as the product was being developed, the API was designed to be flexible so that the client could always access the data it needed on a given view; especially as the views were evolving.

As we’re starting to scale, we’re now finding that there are a lot of performance bottlenecks due to the amount of data we’re passing to the client — some of which is unneeded on a given endpoint.

My question is: in the case of a private API, where you’re also building the only client that will consume the API, is it common (or acceptable) to couple the front end requirements directly to what the backend serves, so that the backend is only providing exactly what the client needs for a given endpoint / view?


Solution

  • Yes. The goal of an API is to provide a reasonable service to all the clients you want to support. If you only have one client, it's both common and acceptable (desirable, even) to optimize your API to support the one client.