If i have something like
@GetMapping(value = "/list")
public ResponseEntity<MyDTO> findStatusPerEC(@RequestParam final List<Long> numbersEC)
How do I add numbersEC in my url on the frontend? Is this query parameter?
I know this one was for old call that didn´t had query parameters and data was only a number (long)
return this.http.get<any>(URL_API + '/simulator/status/' + data);
But now I have to send a list of long values...may you help me?
Since you mentioned
datais only alongtype, what you are referring to here when you make the above request is a PathVariable it is slightly different to a RequestParam./simulator/status/:statusIDwhere statusID is dynamic and extracts values from the URI.?arg=val&arg2=val2etc... and extract values from the request query string.Solution
To answer your question, to send an array across as request parameters, you can do it like so:
?myparam=myValue1&myparam=myValue2&myparam=myValue3As you can see, above
myparamis unchanging, and the values are variable, hence the data within your list data structure.So when you're making your request it will look similar to this:
Angular/Javascript
Java
I hope this helps.