I'm trying to send list of ids to the server in a get request, I'm doing the following:
public loadTripsByIds(tripsIds:number[]): Observable<any> {
let params = new HttpParams();
params = params.append('tripsIds', tripsIds.join(', '));
return this.http.get<TripObj[]>(`${this.baseUrl}/Trips/ByIds/Get`, {params: params});
}
In the server api code ( rest) I have defined list:
@GET
@Path("Trips/ById/Get")
@Produces("application/json")
public List<Trips> loadTripsById(@QueryParam("tripsIds") final List<String> tripsIds) {
What I actually getting in the server is a list with 1 item (String type) with comma separated. for example "10001, 10002". I can parse the string in the server side easily but looking for the right way to send list to server where each element will be id.
Thanks.
loadTripsByIdsinput arguments are, what does the outgoing request look like, and what is it supposed to look like?params.append('tripsIds', tripsIds)