Linked Questions

1 vote
1 answer
3k views

How to pass collection to GET method [duplicate]

I've this GET method in my MVC Web Api: public IQueryable<Employee> GetEmployeeByJobTitle(List<string> jobTitles) { var employeeByJobTitle = from e in db.Employee ...
LarAnto's user avatar
  • 136
-1 votes
2 answers
1k views

API Action - The value '1,2' is not valid [duplicate]

Using Asp.Net Core 2.2 I am calling an API using: products?productsIds=1,2&offset=10&limit=4 But I get the error on model binding for productsIds: The value '1,2' is not valid. I tried with ...
Miguel Moura's user avatar
1 vote
0 answers
724 views

Unable to pass string array as parameter to HttpGet in Web API [duplicate]

My endpoint is decorated like [HttpGet("{data}")] public async Task<MyObj> Get([FromQuery]List<string> data) And I call this via https:.........../api/Learning/one,other,hello ...
MyDaftQuestions's user avatar
1 vote
3 answers
446 views

How to receive IEnumerable<int> from client? [duplicate]

I have the following code. I'd like to do away with ContactIdsString, but I don't then know how to send the int[] in JavaScript to an IEnumerable in C#. Is there any way? Html: @model MyNamespace....
Sarov's user avatar
  • 665
0 votes
0 answers
125 views

Call WebApi action with a list of parameters [duplicate]

Web API code [HttpGet] public string GetMore([FromUri] Int32[] dd) { return ""; } I need to be able to call this web api passing in an array of integers The route at the WebApiconfig is as ...
user581157's user avatar
  • 1,429
638 votes
11 answers
1.2m views

How to pass an array within a query string?

Is there a standard way of passing an array through a query string? To be clear, I have a query string with multiple values, one of which would be an array value. I want that query string value to be ...
Yarin's user avatar
  • 186k
130 votes
12 answers
187k views

Pass array to mvc Action via AJAX

I'm trying to pass an array (or IEnumerable) of ints from via AJAX to an MVC action and I need a little help. the javascript is $.get('/controller/MyAction', { vals: arrayOfValues }, function (...
Dave's user avatar
  • 2,562
66 votes
8 answers
130k views

Pass Array into ASP.NET Core Route Query String

I want to do this, but I want to also be able to pass in arrays into the query string. I've tried things like: http://www.sitename.com/route?arr[]=this&arr[]=that http://www.sitename.com/route?...
user3685285's user avatar
  • 6,706
13 votes
3 answers
35k views

How to get Request Querystring values?

My api client code sends an authentication token in the querystring like: www.example.com/api/user/get/123?auth_token=ABC123 I'm using Mvc Web api controller, and I have a filter that checks if the ...
loyalflow's user avatar
  • 15.1k
13 votes
6 answers
33k views

passing an array to a asp net core web api action method HttpGet

I am trying to send an array of integers to my action method the code looks like so: [HttpGet] public async Task<IActionResult> ServicesByCategoryIds([FromQuery] int[] ids) { ...
zoran djipanov's user avatar
9 votes
3 answers
8k views

ASP.NET Core 1 Web API Model Binding Array

How do you model bind an array from the URI with GET in ASP.NET Core 1 Web API (implicitly or explicitly)? In ASP.NET Web API pre Core 1, this worked: [HttpGet] public void Method([FromUri] ...
marras's user avatar
  • 91
6 votes
2 answers
9k views

Passing array of integers to WebAPI method in URI params?

I have the following: [HttpDelete] public HttpResponseMessage DeleteFolder(int[] ids) { and I'm trying to use this: DELETE http://localhost:24144/api/folder/1483; DELETE http://...
SB2055's user avatar
  • 13k
5 votes
2 answers
12k views

DELETE multiple IDs with WebAPI Delete Endpoint?

My webAPI solution currently works if I send a single id to the delete endpoint: DELETE /api/object/1 With: [HttpDelete] public HttpResponseMessage DeleteFolder(int id) { // Do ...
SB2055's user avatar
  • 13k
3 votes
1 answer
10k views

How to pass an array of int in ASP.NET Core Web API

I have this Web API method: [Route("api/[controller]")] [ApiController] public class SubjectsController : ControllerBase { [HttpGet("children")] public IActionResult GetAllFromChildren([...
g_b's user avatar
  • 12.5k
2 votes
2 answers
4k views

How to pass parameters to array class in webapi?

I am new to asp.net mvc webapi.I am create one webapi service.In this service I am sending parameter as an array class. Below is my service : [AcceptVerbs("GET", "POST")] public HttpResponseMessage ...
Anil Kumar's user avatar

15 30 50 per page