J Doe.
J Doe.

Reputation: 349

How is HTTP data sent in PUT and DELETE requests?

In an HTTP GET request, all data is found in the URL.

In an HTTP POST request, all data is found within the HTTP body.

Where is the data in a DELETE or PUT request?

Upvotes: 0

Views: 134

Answers (2)

cassiomolin
cassiomolin

Reputation: 131187

From the RFC 7231:

4.3.5. DELETE

[...] A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.

4.3.4. PUT

The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload. [...]


For both methods, you can send data in the URL using path / matrix and query parameters.

Upvotes: 1

user820304
user820304

Reputation:

Put simply, as far as passing data with your call goes:

  • DELETE should follow the same guidelines as GET
  • PUT should follow the same guidelines as POST

Upvotes: 1

Related Questions