Passing multiple parameters from angular to rest service

Passing multiple parameters from angular to rest service

how to send multiple parameters in post request in angular 6
how to pass multiple parameters in http request in angular 6
spring rest multiple @requestbody parameters, possible
can't bind multiple parameters to the request's content
how to pass parameter to service in angular 6
pass multiple parameters to web api get method c#
web api post method with multiple parameters c#
how to pass multiple parameters in angularjs service

I am trying to pass the data to my rest services through $http.get() using URL.There are 10-12 parameters which I need to pass.

Angular script.js

$http.get('rest/test/getAllData/?filter1='$scope.filter1 + 
           '&filter2='$scope.filter2 + '&filter3='$scope.filter3 + 

The scope variables would come as undefined sometimes.But I guess that will not be a problem.I checked the console, the URL is getting formed correctly with all 12-13 parameters.

Now I am trying to get this in rest service using @QueryParam like below -

public response getAllData(@QueryParam("filter1") final String filter1,
                           @QueryParam("filter2") final String filter2,
                           @QueryParam("filter3") final String filter3){

The problem is that the @QueryParam is working for 2 parameters but when I am increasing the number of parameters, it is failing. As per the browser console, I am getting 404 error.

Is there any limitation to the number of parameters we can pass? I need to pass 12-13 parameters.How can I achieve this?

Update -

I was able to resolve my issue . I was using Date datatype in @QueryParam because of which it was throwing 404 error . Changed it to String and it worked . Did not know that we cannot use Date in QueryParam .

Apologies for not putting the detailed problem .

If you want to do it in the proper RESTful way then you can try like this, I have given it for couple of variables, but you can do for any.

@RequestMapping(path = "/rest/test/getAllData/{filter1}/{filter2}", method = RequestMethod.GET)
public Data getAllData(@PathVariable String filter1, @PathVariable String filter2) {
  // code here

You can also achieve it using RequestParam, an example below, ensure your parameters matches

@RequestMapping(path = "/rest/test/getAllData", method = RequestMethod.GET)
public Data getAllData(@RequestParam String filter1, @RequestParam String filter2) {
// code here


If you still have a complicated structure then send it as a POST with the JSON data in the request body

@RequestMapping(path = "/rest/test/getAllData", method = RequestMethod.POST, consumes = "application/json")
public Book getAllData(@RequestBody ObjectKey objectKey) {
// code here


re: Passing multiple POST parameters to Web API Controller Methods, You would typically pass a single object as a parameter to the PUT and POST action methods. Note that Web API does not support passing  Angular router uses patterns to pass route parameters and extracts parameters with ActivatedRoute service. Services in Angular 7 allow you to define code that's accessible and reusable throughout multiple components. As we can see, the From will by default POST to the ‘api/Values’ controller.

For passing more number of parameters, you can use Rest parameter. It is used to access indefinite number of arguments passed to a function.

Syntax :

function add (...numbers){}

How to pass multiple parameters to Web API controller methods , In this how-to article, we'll learn how to use fromString and HttpParams to pass query parameters to URLs or REST API endpoints. In this article, you will learn by creating a complete application for Angular 4 Multiple File Upload using ASP. post is RxJS Observable which represents values over any amount of time. data: This property to send required parameters to requested url. REST web service will expose methods for create, read, update and delete operation.

 const params = new HttpParams()
  .set('paramName1', value1)
  .set('paramNmae2', value2);
   return this.httpClient.get<IMyObject[]>(this.myUrl, {params} ).pipe(

Angular 9/8 How-To: Pass URL Query Parameters with HttpClient , Passing the URL Parameters. Open the github.service.ts . Import the HttpClient & HttpParams from the @  Configure Navigation & Passing Parameters to Route. To visit the products page, inject the routerLink="/products" directive in the anchor tag. To enable the active class in Angular 10/9, use the routerLinkActive="" directive along with the active CSS class.

URL Parameters, Query Parameters, httpparams in Angular , Is it possible call the service adding a param taken by controller? You can pass parameters to $http.get like this : $http.get(URL, { params: { id: myId } }).success(. how to make Generic method for rest call in angularjs ? i have tried for single  For the above method i will be sending a class object and an id as parameter. Till now i have achieved passing multiple parameters like string,string,int etc.. and passing a class object by serializing the data. But no luck with passing class object along with one more parameter like the case mentioned above.

Pass multiple parameters to $ - angularjs - html, I wanted to pass more than one route parameter in a React URL route path, then The React solution to multiple route parameters in a URL path. I was using The Movie Database API to supply movie data to my React front end project. Spread & Rest Parameters: JavaScript ES6 Feature Series (Pt 4)  This post is a guide how to Pass the URL Parameters or Query string along with the HTTP Request using the HttpClient in Angular. We will be using HttpParams to add the query parameter, which is then used by the httpClient.get method to send a get request to the GitHub API.

How To Pass Multiple Route Parameters in a React URL Path, Retrieves all values for a parameter. getAll(param: string): string[] | null. getAll(  The Angular adds the map all the route parameters in the ParamMap object, which can be accessed from the ActivatedRoute service The ParamMap makes it easier to work with parameters. We can use get or getAll methods to retrieve the value of the parameters in the component.