PHP code for JSON Payload ExampleThis PHP code snippet was generated automatically for the JSON Payload example.
<< Back to the JSON Payload example
What is JSON?
What is JSON Payload?
The request payload is important information in a data block that clients send to the server in the body of an HTTP POST, PUT or PATCH message that contains important information about the request. The Payload can be sent or received in various formats, including JSON. In programming, the payload is used in the context of a message protocol to distinguish between ancillary and actual data in a request. For example, request headers are required by the server to interpret and process the request from a client correctly, but they are not the request's payload. JSON syntax elements are also not a payload.
- "id": "12345" - Payload
- The rest of the information is called service data.
API Payload Formats
The following are the two types of payload:
The Payload that the client sends to the server
- "Id": 78912 and "Customer": "Jason Sweet" are Payload
The Payload returned by the server
1. The OK response Payload format:
- "success": "true" and "TotalOrders": 100 are Payload
2. The FAILED response payload format:
- "success": "false", "errorCode": 500 and "errorDescription": Invalid user ID" are Payload
JSON Payload Request Example
Example of sending JSON Payload to ReqBin echo URL:
JSON Payload Response Example
Example of server response with JSON Payload: