This might be an easy one and I just miss something. I have a GET endpoint and I am trying call it from an Angular UI. I want to send an timestamp to an endpoint as a parameter. I did the basic way:
return this.http.get(this.Uri + academyId + "?dateWhenToCalculate=" + (dateWhenToCompute.getTime() / 1000).toString()).pipe(
map((res: Response) => res.json() as Model),
catchError(this.handleError));
Using this I get this URL: http://host/api/route/1?dateWhenToCalculate=1572991200. My endpoint is like:
[HttpGet]
[GenericAuthorizeFilter]
[Route("route/{academyId}")]
public IHttpActionResult ComputePlayerScores(int academyId, string dateWhenToCalculate){....}
Using that way of creating the url all is working fine. But when I am trying to do it with HttpParams I keep getting a strange URL and of course an 404 error.
let httpParams = new HttpParams()
.set('dateWhenToCalculate', (dateWhenToCompute.getTime() / 1000).toString());
return this.http.get(this.Uri+ academyId, { params: httpParams}).pipe(
map((res: Response) => res.json() as Model),
catchError(this.handleError));
Using HttpParams I got this
Did I miss something?