return this.http.get<any>(URL_API + '/simulator/status/' + data);
Since you mentioned data
is only a long
type, what you are referring to here when you make the above request is a PathVariable it is slightly different to a RequestParam.
- Path variables have the syntax:
/simulator/status/:statusID
where statusID is dynamic and extracts values from the URI.
- Request parameters have the syntax:
?arg=val&arg2=val2
etc... 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=myValue3
As you can see, above myparam
is 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
return this.http.get<any>(URL_API + '/list' + '?myparam=myValue1&myparam=myValue2&myparam=myValue3');
Java
@GetMapping(value = "/list")
public ResponseEntity<MyDTO> findStatusPerEC(@RequestParam final List<Long> numbersEC)
I hope this helps.