I am creating a new RESTful API which has an endpoint
GET v1/my-resource/{encoded-url}
When I try and send a message to this endpoint, I get a 404
GET v1/my-resource/%2Fshop%2Fgender-women-category-bags
When I try and send my-url it returns a 200.
GET v1/my-resource/my-url
This is my method:
[ApiController]
[Route("")]
public class GetController : ControllerBase
{
[HttpGet("v1/my-resource/{url}")]
public async Task<IActionResult> GetResource(
[FromRoute, Required] string url)
{
return Ok();
}
}
Can anyone help me understand why I can't pass %2Fshop%2Fgender-women-category-bags as the encoded url?
[HttpGet("v1/my-resource/{**url}")]?**do?/my-resource/would be included in theurlvariable. Note, I cannot replicate your problem in my code here./shop/gender-women-category-bags. Thanks for the help