I am a newbie to asp.net Web API service. I want to create a method that does not return any value one-way method. How can I achieve this in asp.net Web API service? I did a lot of search on google but I do not know what exactly should happen. I consume this service from an Android mobile app and the only thing came to my mind is just ignore the returned response from service. Is this possible? this method will send an email to the user.
An HTTP request should always return something, even if it's an empty response which does nothing more than indicate success. Which you can do in Web API with the Ok()
response:
return Ok();
the only thing came to my mind is just ignore the returned response from service. Is this possible?
Of course. Any code can ignore the response from any other code. Conceptually it's no different from calling a method and ignoring the returned result. Simply make your HTTP request and then have no handlers for the response.
Note however that it is recommended to at least check for a successful response just to ensure that there wasn't an error. Otherwise, well, there could have been an error and you'd never know.