Net core application. I have one GET api as below:
[HttpGet]
[Route("configId={configId}"eId={quoteId}"), EnableQuery()]
public async Task<IEnumerable<Scenario>> GetScenario(string configId, int quoteId)
{
var result = await configScenarioService.GetScenarioAsync(configId, quoteId);
if (result.IsSuccess)
{
return result.scenarioResults;
}
return new List<Scenario>();
}
I am trying to hit from Postman as below:
https://localhost:44362/api/v1/Scenario/configId=JBEL+ASS_60_SG_5.2-145_MY21_T102.5_25y"eId=236
Unfortunately, this is giving 404 error. Maybe the '+' sign is causing the issue. After looking into some documentation, I tried as below:
1. https://localhost:44362/api/v1/Scenario/configId="+ encodeURIComponent(BEL+ASS_60_SG_5.2-145_MY21_T102.5_25y) +""eId=236
This didn't work for me and still gave a 404 error.
How can this be fixed?
since you have + sign you have to encode your url, for + url encoded is %2B https://www.w3schools.com/tags/ref_urlencode.asp
..../Scenario?configId=JBEL%2BASS_60_SG_5.2-145_MY21_T102.5_25y"eId=236
and since you have 404 you have to fix an action route too
[Route("~/api/v1/Scenario")]
public async Task<IEnumerable<Scenario>> GetScenario([FromQuery] string configId, [FromQuery] int quoteId)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With