Search code examples
c#asp.net-web-api2quartz-schedulerjob-scheduling

Writing a method to trigger a job in webapi should be a post or a get call?


So while writing a controller for my scheduler, I was wondering which is cleaner, should I make a post call to trigger a job? or a get call?


Solution

  • A post is semantically better than get, because the concept of a job is to do some processing rather than getting something for you.

    If your api method intended to just get/retrieve some data to the caller, then it wouldn't look like a job at all.

    You may also have a get and a post altogether, where the post will do the job, and get will return the result of that job.