PHP code for Test JSON Response Online Example
This PHP code snippet was generated automatically for the Test JSON Response Online example.<< Back to the Test JSON Response Online example
What is JSON?
JSON (JavaScript Object Notation) is a language-independent text format for storing and exchanging data. A web application uses JSON to exchange data between a web browser and a server and to exchange data between servers using REST API. For many programming languages, including Java, JavaScript, C ++, C #, Go, PHP, and Python, there are ready-made code libraries for creating and manipulating JSON data. JSON file names use the .json file extension.
What is REST API?
REST (Representative State Transfer) is a way to connect two computer systems over the Internet. The REST API is browser and programming language-independent. Any modern browser can be used to run your REST API client, and any programming language can be used to create desktop or mobile REST API applications.
The REST API define a set of rules for developers:
- Client-server: a REST API client (website, desktop or mobile application) should separate from the REST API server (request processor and data storage) so that each part can be developed and scaled independently.
- Stateless: REST API requests must be executed with all the necessary data without assuming the server may have previous REST API client data.
- Layered: the REST API client does not need to know if it communicates with an actual server or an intermediary. Additional scalability and security can be provided by intermediate servers (proxies or load balancers).
- Cacheable: Every REST API response must be cacheable.
How to test a JSON response?
To test a JSON response using the ReqBin JSON API test tool, first, send a JSON request:
You will receive a JSON Response from the server: