I’m creating a web service using ASP.NET’s WebAPI.
It seems that the method name in the ApiController is mapped to the Uri.
E.g., PutProducts to add products
What if I want a method that executes say.. a batch file.. like ExecuteProcess1();
This need not return any value of any business worth. It’s just for the clients to fire at will, where will this fit in my web service? What should the method be called?
If the method is modifying some state on your server (such as updating records in a database, writing to files, …) you should use the POST HTTP verb. Depending on the resource that this method is modifying you could have a corresponding API controller:
Obviously you will replace SomeResource in the name of this controller with the resource you are manipulating (Products, Orders, People, …).