Python code for PUT JSON Example
This Python code snippet was generated automatically for the PUT JSON example.<< Back to the PUT JSON example
What is JSON?
JSON (JavaScript Object Notation) is a language-independent format for storing and exchanging data. The JSON format is used with almost any programming language and API. JSON is widely used by web applications to exchange data between a web browser and a server and exchange data between servers via REST or JSON APIs. The JSON format is well suited for serializing complex and large data structures. JSON files can contain only text, not take up much disk space, and have a .json extension.
What is HTTP?
Hypertext Transfer Protocol (HTTP) is a network data transfer protocol that enables the communication between HTTP clients (browser or mobile application) and servers. HTTP is built on request-response messages between a client and a server. The client sends a request to the server, then the server processes this request and sends a response back to the client.
What is the HTTP PUT method used for?
The HTTP PUT request method is used to update an existing resource on the server. You can send any data in the body of the PUT request. Data type and size are not limited. The PUT request method is defined as idempotent, which means that multiple identical PUT requests should have the same effect as a single request (do not cause any changes in data).
To update an existing resource on the server, the client must provide a JSON that contains mutable fields with new values. If the requested object does not exist, the server can create it. In this case, the server informs the client that the resource has been created with a 201 (Created) status code in response to the PUT request. If the requested resource is successfully updated, the server will return 200 (OK) or 204 (No Сontent) status codes.
PUT JSON Example
The following is an example of sending JSON data to ReqBin echo URL using the HTTP PUT method:
Server response to our PUT request: