4
7 Comments

API question - overlaying a master API

I have a number of APIs that fetches different information. Over time, the list grew. Is it a weird idea to have a "master" API end-point that is user-facing and fetches the different data required or still keep to issuing many APIs?

What I meant is having this master API somewhat as a "router" rather than re-coding a heavy API.

  1. 2

    I don't think that's weird, I think it can even be a good practice to have some layer of abstraction between in front of third-party APIs.

  2. 1

    What you explain is a common scenario, Look up API gateways and some allow you to "compose" apis from your existing API endpoints too. Tyk is a good open source API gateway.

  3. 1

    thanks for all the advice!

  4. 1

    As long as your API is well structured I'd contend that they are the same thing and it doesn't really matter.

    Your client is requesting a specific service or piece of data and needs to define what it wants such that your server knows how to route it. That routing can be at the url level if the API is REST-based, or you can have a generic /api but then that single endpoint needs to be passed the same information as would be required via REST!

    Either way, given the growth of the api surface area, it could be a good time to refactor to make everything consistent.

  5. 1

    It's not unusual to have small "internal" services serving specific APIs to each others, and one client facing API. It's also easier to manage the security for outside connections in one API vs many.

  6. 1

    You really need to have a concise and understandable client facing API and it doesn't matter if all these APIs are behind the same service/router/gateway. You can have many different services each providing a different API, as long as the experience for users is pristine. For example, release an SDK in relevant languages that handles the switch between services. Then you don't need the overhead of a router. Having a router is unnecessary expense that you never get back. It's a waste to make and a waste to maintain and a waste in performance in use.

  7. 1

    It's hard to give specific input without knowing the specifics of your APIs, but I think it often makes sense to have a single entry point for all of your APIs like /api.

  8. 1

    This comment was deleted 8 months ago.

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments