Rest Put
No edit summary
(Automatically adding template at the end of the page.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Rest]]
[[Category:Rest]]
An HTTP method called "PUT" is often used in RESTful web services to update or create a resource identified by a specific URL.
"PUT" is often used in RESTful web services to update or create a resource identified by a specific URL.


In RESTful web services, the HTTP PUT method is used to request the server to update or create the resource specified by the URL. The server responds with a status code indicating the success or failure of the operation.
In RESTful web services, this method is used to request the server to update or create the resource specified by the URL. The server responds with a status code indicating the success or failure of the operation.


For example, if you want to update the details of a user with the ID "123" in a hypothetical RESTful API, you could send an HTTP PUT request to the URL:
For example, if you want to update the details of a user with the ID "123" in a hypothetical RESTful API, you could send an HTTP PUT request to the URL:
 
<nowiki>https://example.com/users/123</nowiki>
<code><nowiki>https://example.com/users/123</nowiki></code>
 
You would include the updated details of the user in the body of the PUT request. The server would then attempt to update the user with the ID "123" with the new details and respond with a status code indicating the success or failure of the operation.
You would include the updated details of the user in the body of the PUT request. The server would then attempt to update the user with the ID "123" with the new details and respond with a status code indicating the success or failure of the operation.


If the user with ID "123" did not exist, the server would create a new user with the specified details.
If the user with ID "123" did not exist, the server would create a new user with the specified details.
{{Edited|July|12|2024}}

Latest revision as of 15:45, 10 February 2024

"PUT" is often used in RESTful web services to update or create a resource identified by a specific URL.

In RESTful web services, this method is used to request the server to update or create the resource specified by the URL. The server responds with a status code indicating the success or failure of the operation.

For example, if you want to update the details of a user with the ID "123" in a hypothetical RESTful API, you could send an HTTP PUT request to the URL:

https://example.com/users/123

You would include the updated details of the user in the body of the PUT request. The server would then attempt to update the user with the ID "123" with the new details and respond with a status code indicating the success or failure of the operation.

If the user with ID "123" did not exist, the server would create a new user with the specified details.

This page was edited 99 days ago on 02/10/2024. What links here