I was wondering if I could generate dynamyc urls for my endpoints api inside controller.
This is what I have
[HttpGet]
[Route("{code}")]
public async Task<IHttpActionResult> GetLanguageByCodeAsync(string code, CancellationToken cancellationToken)
{
var url = $"{BaseUrl}/{code}";
return await GetAsync(url, cancellationToken);
}
Is there a way to have something like this?
var url = $"{BaseUrl}{Dynamic}";
The idea is that Dynamic read the code parameter or even other ones and construct the url based on them.
I do not want the code to be hardcoded in the url since in a future I would need to add parameters, so I will need to hardcode them in the url variable too. I want this to be flexible.
Aucun commentaire:
Enregistrer un commentaire