PHP : REST API – Introduction
In this tutorial, we will learn about PHP & REST APIs. REST and other APIs are used to provide communication and interaction between two systems.
Why we use APIs?
There are many large organizations that provide access to their data to multiple systems. The stock market provides access to live data using APIs. News media also publish their news on multiple platforms using various APIs.
You can book a movie ticket using a website as well as using a mobile app. Both use some kind of APIs to communicate with each other. Social Media websites also use APIs to show your feed data into your website. There are so many uses of APIs in today’s time.
Important Terms
Let us know about various terms we use while working with the REST API.
What is REST?
REST stands for REpresentational State Transfer. It is an architectural style for providing standards between network-based software. REST is a popular standard to create Web services.
REST APIs
REST (or RESTful) API is a medium of communication between systems on the Internet. REST APIs works with multiple standards like HTTP, JSON, URL, and XML. REST APIs uses HTTP methods such as GET, HEAD, POST, PUT, DELETE to perform different operations.
JSON
JSON stands for JavaScript Object Notation. JSON is a standard file format to transfer data between two applications. JSON data consist of attribute-value pairs rendered inside curly braces. JSON data can store objects, arrays, string, integer etc.
Objects are denoted inside Curly { } bracket and Arrays are stored inside Square [ ] bracket.
[{
"id": "1",
"name": "Robin",
"age": "20"
}, {
"id": "2",
"name": "Deepak",
"age": "25"
}]
XML
XML stands for eXtensible Markup Language. It uses customize markup to store and transfer data. XML & JSON are the two popular data formats used in APIs.
cURL
cURL stands for client URL. It is used to exchange data between servers using HTTP and other protocols.
In the next tutorials, we will learn how to work with APIs data using cURL and PHP functions.
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |