Simple question: what if I’m NOT sending data (content) via HTTP POST/PUT method on my resource — is it still RESTful?
Obviously, the question is in which case would I want use PUT without data. Imagine a user that wants to reset his/her password (like in this older topic).
What do you think of it? Is it okay NOT to send content with POST/PUT methods? Personally I have no problem with it but I’m just curious what would other people say.
Yes, this is perfectly acceptable. Each action (POST to a collection, PUT to a resource) when performed with no data should create a new, “empty” resource. The definition of “empty” here would depend on what is being represented.
In the specific case of resetting a user’s password, however, I wouldn’t say that the above model applies. If there truly is a password resource, a PUT with no data would seem to suggest setting the password to be empty, rather than resetting it. For this scenario, I’d go with the accepted answer from that question.