What is REST API in PHP?
Before explaining what is ‘REST API‘ we should know what is ‘REST’ and ‘API’.
REST stands for ‘Representational State Transfer’. REST is web standards-based architecture and uses HTTP Protocol for exchanging data between applications or systems. It is a simple way to interact with independent systems.
API stands for ‘Application Programming Interface’. Basically, these are small functions which allow two different systems to talk/interact with each other.
In many applications REST API’s are used because it’s a simple and lightest way to Create, Read, Update, Delete (CRUD) data between different applications over the internet. To develop Android, IOS mobile apps REST APIs are being used.
When you hit an API your request is being sent to the remote server, then it performs some required functions and returns its response in JSON or in XML format.
In REST API following HTTP methods are used,
GET – Use to retrieve data.
POST – It is used to add or insert data into a database.
PUT/PATCH – It is used to update any existing records.
DELETE – To delete any existing records DELETE method is used.