Routes in ASP.net Core API
Try this. You can put a common route prefix on the controller.
[Route("api/[controller]")]
public class BXLogsController : Controller {
//GET api/BXlogs/id/blah
[HttpGet("ID/{id}", Name = "GetL")]
public IActionResult GetById(string id) { ... }
//GET api/BXlogs/api/blahapi
[HttpGet("API/{apiname}", Name = "GetLAPI")]
public IActionResult GetByAPI(string apiname) { ... }
}
read up on attribute routing here Routing to Controller Actions
In case if you're planning to have a custom action name similar to web API's.
[Route("api/[controller]")]
public class BXLogsController : Controller {
//GET api/BXlogs/blahapi
[HttpGet("{apiname}", Name = "GetLAPI")]
public IActionResult GetByAPI(string apiname) { ... }
}
a little extended to @nkosi
So you'll be calling as
GET: https://localhost:44302/api/BXLogs/GetLAPI