Skip to content
Advertisement

Difference between component API and Backend API?

Hi guys this is a question based on a scenario.

Implementing autocomplete widget where it,

  • fetch data from backend
  • render results as a tree
  • support for radio, checkbox , icons

In here what does the component’s API looks like?

what does the backend API looks like?

I know what is an API but this makes me really confusing.

Advertisement

Answer

(Disclaimer: gross oversimplification here)

API is just a way of how computers speak to each others in a very structured way.

Component’s API is usually a signature of some modules/packages/functions. In other words, it’s an explanation of how to interact with a component. Note, that the component can be very complex inside, but provide a very clean and easy to use API. This API describes how to use the component, what arguments to provide, what you get when running it, etc. Here is an example of a component’s API – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date (in this case it’s a JavaScript Date object)

A backend API is the same contract/way of interacting, but over network, like REST API or GraphQL. Backend API defines which urls/ips you need to connect to, what to send to them, and what to expect. Here is an example of BE API – https://www.teslaapi.io/vehicles/list (in this case it’s Tesla’s public API)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement