Reputation: 21
I am writing a simple Web API application. I am writing a post method to add records like this:
[Route("api/{Inspection}/{post}/{date}/{inspectorId}/{unitID}/{time}")]
[HttpPost]
public void PostInspection(string date,int inspectorId,int unitID,string time)
{
InspectionDataClass inspectionData = new InspectionDataClass();
inspectionData.InsertRow(date,inspectorId,unitID,false,false,"", time);
}
and call the method in browser like this:
http://localhost:34367/api/inspection/97/3/13/10
but it doesn't execute.
Upvotes: 0
Views: 133
Reputation: 191
Your attribute :
[Route("api/{Inspection}/{post}/{date}/{inspectorId}/{unitID}/{time}")]
But you browser url with:
http://localhost:34367/api/inspection/97/3/13/10
Did you have miss the path for /{post}/?
And sorry for my last wrong anser and my pool English.I thought you have using asp.net core.
Upvotes: 1