The idea is that there will be an external entity (SharePoint) that will call my WebAPI and pass in a PDF file as well as some extra, metadata information about that PDF file. I'm stuck on how to construct the signature of the Web API method. Here's what I have so far:
public class IssueController : ApiController
{
private TestEntities db = new TestEntities(HelperClasses.ConnectionStringHelper.GetConnectionString());
[HttpPost]
public HttpResponseMessage SavePdf(Article a)
{
// save the PDF to a file share & metadata to the SQL database
}
}
My inclination would be to do something like:
public class IssueController : ApiController
{
private TestEntities db = new TestEntities(HelperClasses.ConnectionStringHelper.GetConnectionString());
[HttpPost]
public HttpResponseMessage SavePdf(Article a, HttpPostedFileBase file)
{
// save the PDF to a file share & metadata to the SQL database
}
}
But, I'm not sure with WebAPI how to exactly do this.
QUESTION: How would I define a WebAPI method capable of accepting PDF data & some extra metadata as a POST
request from an external entity?