I have to develop a REST API that have to handle POST request (taking a payload from the body of my request) and at the same time taking an URI parameter.
Into my controller class I have something like this:
public class MailProtocolloController : ApiController
{
[SharePointContextWebAPIFilter]
[HttpPost]
[ActionName("protocollo/mail")]
public IHttpActionResult InviaAlProtocollo(XXX)
{
return Ok("TEST");
}
}
My problems are:
As you can see I am using the ActionName annotation to specify the URL path handled by this controller method. How can I specify the URI parameter into this ActionName annotation? (can I?) It have to handle something like this: protocollo/mail/{id}
What input parameter have to be specified for this controller method? One for the ID retrieved from the URI (a string) and an object for the request payload? Or this payload can be retrieved inside the method?
How can I implement this behavior?