-2

I am using Spring Boot for creating rest API. I learnt about PUT, PATCH, POST. PUT is for updating the resource and if Id is not present then it creates. Patch is for updating part of the resource and Post for creating new resources.

What I don't understand is, are they are only standards that helps outside world to let all know what the API is for ? Because I can do the same implementation in Put like Patch and make Put request to perform partial updates.

halfer
  • 19,824
  • 17
  • 99
  • 186
Lolly
  • 34,250
  • 42
  • 115
  • 150
  • 1
    Your wording of the question needs work. Also what does a question regarding the purpose of HTTP methods have to do with Spring Boot? – BernardV Jun 22 '23 at 13:58
  • I just wonder how a user with over 30k rep and `spring-boot` tag on more than 50% of their posts could ask this kind of newbie question. Is this some kind of joke? Or are you guys grinding rep this way? – Vasily Liaskovsky Aug 09 '23 at 17:59

1 Answers1

0

HTTP Methods are standard or specification

As you said, you can implement with totally ignoring what standard says, but it means your software/api should be used with concerns(because this don't follow standards), which make integration with others complicated.

For example, old standard says there can't be no body should be sent on GET, and Java developers followed this standard faithfully, errors occurred or were ignored when adding a body to a GET request, which made some developers in trouble who did not followed standard.

Read also: HTTP Methods definitions - RFC 9110

Mina-
  • 61
  • 1