additional parameters in GET request

Hello, how can i send additional parameters in GET request using asp net core and angular?


[Api]

  [Route("api/dimensions")]

        [HttpGet]


        public IHttpActionResult Get(int docui)

        {

            try

            {

                var data=new DMSRegisterGateway().GetDimensionsFromServer(1).ToList();

                //return Json(new DMSRegisterGateway().GetDimensionsFromServer(1).ToArray());

                return Json(new { result = data });

            }

            catch (Exception e)

            {

                return InternalServerError(e);

            }

        }


[Angular]

this.data=new DataManager({
            url'api/dimensions',
            adaptornew WebApiAdaptor ,
            crossDomain:true
          });

1 Reply

RS Rajapandiyan Settu Syncfusion Team August 19, 2021 01:38 PM UTC

Hi Tarik, 
 
Thanks for contacting Syncfusion support. 
 
Based on your requirement, you want to send additional parameters to the server side. you can achieve this by using the addParams method of grid.query. This is explained detailly in the below documentation.  


Find the below code example and screenshot for more information.  

 
load() { 
  grid.query = new Query().addParams('ej2grid', 'true'); 
} 
 
 
[OrdersControllers.cs] 
 
    public class OrdersController : ApiController 
    { 
        // GET: api/Orders 
        [HttpGet] 
        public object Get() 
        { 
            var queryString = HttpContext.Current.Request.QueryString; 
            int skip = Convert.ToInt32(queryString["$skip"]); 
            int take = Convert.ToInt32(queryString["$top"]); 
            var ej2grid = queryString["ej2grid"]; // get the additional params  
            var data = OrdersDetails.GetAllRecords(); 
            return new { Items = data.Skip(skip).Take(take), Count = data.Count() }; 
        } 
   } 
 


 
Screenshot #1: Request to the server 
 
 
 
Screenshot #2: Get the additional params value at server 
 
 
 
Please get back to s if you need further assistance with this. 
 
Regards, 
Rajapandiyan S 


Loader.
Up arrow icon