Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Msoft's avatar
Level 1

What is the main purpose of developing REST API?

what is the main purpose of developing REST API. please explain with some example?

0 likes
5 replies
douglasakula's avatar

@msoft To provide an interface that will enable systems to communicate and exchange data in a unified format.

An example can be an ecommerce android app for amazon. The android app would need data on items on sale that are hosted on a remote server. An api becomes the interface through which the android app can request the data on items on sale from the remote server. Same way when an order is made through the android app - the API becomes the interface through which the order is posted to the remote server

1 like
audunru's avatar
  • Open up your app so your customers can access their data and use it in new ways. After all, it's their data.
  • Allow other applications (developed by you or someone else) to interact with your existing application
  • Allow others to develop new applications on top of your application
  • Comply with local regulations that may or may not require you to allow access to customer data through an API (think PSD2 for banking in the EU or public access to government data if it's a government application)
  • Stop using HTML templates rendered server-side, start using client side React/Vue/etc applications that fetch data from your API
  • Make the API the only way to access data in your app, so that you consume your own API as well as let others access it from the outside. If not, you'll have to maintain an internal API as well as an external API.
1 like
audunru's avatar

I followed https://laracasts.com/series/incremental-api-development when I wrote my first API in Laravel. It might be a bit dated because I think Resource was added to Laravel later.

I use Passport for authentication. I don't think it's mentioned in that series, but I saw @dunsti already posted a bunch of links which mentioned it. You should definitely use it.

1 like

Please or to participate in this conversation.