Learn how we can create PHP Rest API.

REST API means Representational state transfer is a software architectural style that defines a set of constraints to be used for creating Web services. In this article, you’ll learn everything you need to know about REST APIs to be able to read the API documentation and use them in your project.

What is REST Api

What is the REST API?

Let say if you want to find a person on twitter you go to twitter search bar enter person name and hit enter you find no of user matching your search term. REST API works in a similar way, you search for something you get a list of results back from the server.

What is API?

API is an application programming interface, It Is basically a set of rules that define how the software will communicate. The developer creates API in a server and allows the client to communicate with the server.

REST determines how the API looks like. It stands for “Representational State Transfer”. It is a set of rules that developers follow when they create their API.  It is an architectural style for distributed hypermedia systems and was first presented by Roy Fielding in 2000 in his famous dissertation.

In REST API Each URL is called a request while the data sent back to you is called a response.

Anatomy Of A REST API Request

  1. The endpoint
  2. The method
  3. The headers
  4. The data (or body)

Sample JSON Response from REST API

 

To learn how we can create PHP Rest API you can read this post.