4

I create application in RESTful standards. I know when I should use GET action, when POST or PUT etc.

But now I have specific case. I don't want to send any data to action ang don't want to receive any data. I just want to ask server on special addres and action will do some work. Can return just 204 status(NO CONTENT) and that's it. Should I use GET method for this case? Or something different?

Kamil P
  • 708
  • 8
  • 26

1 Answers1

2

Definitely use POST. Most other methods are meant to be idempotent: they should have same effect on system, no matter how many times you call them with same parameters. Your situation is the opposite: each call initiates execution of new task (if I understood you correctly). Also note, that according to the REST paradigm there are no "actions"—only resources. Name your resource "XXX_task" and you will see POST-ing to it as something, that makes sense semantically.

user1643723
  • 3,634
  • 1
  • 20
  • 44