Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:21:36+00:00 2026-06-16T06:21:36+00:00

I have a .net mvc 4 webapi project that I’m trying to pass an

  • 0

I have a .net mvc 4 webapi project that I’m trying to pass an array of an object to a method on my controller.

I’ve found some examples here on SO that talk about needing to set my object’s properties with: param1=whatever&param2=bling&param3=blah.

But I don’t see how I can pass in a collection using that.

Here is my method signature. Notice I’ve decorated the argument with the [FromUri] attribute.

public List<PhoneResult> GetPhoneNumbersByNumbers([FromUri] PhoneRequest[] id)
{
    List<PhoneResult> prs = new List<PhoneResult>();
    foreach (PhoneRequest pr in id)
    {
        prs.Add(PhoneNumberBL.GetSinglePhoneResult(pr.PhoneNumber, pr.RfiDate, pr.FinDate, pr.State));
    }
    return prs;
}

here is my simple PhoneRequest object:

public class PhoneRequest
{
    public string PhoneNumber { get; set; }
    public string RfiDate { get; set; }
    public string FinDate { get; set; }
    public string State { get; set; }
}

and here’s a sample of what I’m using to pass in:

http://localhost:3610/api/phonenumber/getphonenumbersbynumbers/
   [{"PhoneNumber":"8016667777","RfiDate":"","FinDate":"2012-02-11","State":"UT"},
    {"PhoneNumber":"8018889999","RfiDate":"2012-12-01","FinDate":"","State":"UT"}]

using this comes back with “bad request”

I also tried this

http://localhost:3610/api/phonenumber/getphonenumbersbynumbers?
    id=[{"PhoneNumber":"8016667777","RfiDate":"","FinDate":"2012-02-11","State":"UT"},
        {"PhoneNumber":"8018889999","RfiDate":"2012-12-01","FinDate":"","State":"UT"}]

which does reach the method, but the array is null.

how can I pass in an array of my PhoneRequest object to my Web API method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:21:37+00:00Added an answer on June 16, 2026 at 6:21 am

    Try passing the PhoneRequest[] from the uri in this format:

    http://localhost:3610/api/phonenumber/getphonenumbersbynumbers?
        id[0][PhoneNumber]=8016667777&id[0][FinDate]=2012-02-11&id[0][State]=UT&
        id[1][PhoneNumber]=8018889999&id[1][RfiDate]=2012-12-01&id[1][State]=UT
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my ASP.NET MVC WebApi project I have a Repository (with an Interface) that
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I have an ASP MVC Web Api project that outputs json using json.net. I
I have a Windsor ASP.NET MVC WebAPI project setup like: http://nikosbaxevanis.com/2012/07/16/using-the-web-api-dependency-resolver-with-castle-windsor-scoped-lifetime/ Everything works fine
My project consist of: MVC, WEB API solution. I have generated an ADO.NET entity
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have ASP.Net MVC project. Plus wordpress blog under a subfolder /Blog. Now, when
I have a ASP.NET MVC 4 project and a SQL View (vvItem). ItemController MVCAppEntities
I have an ASP.NET MVC 4 Application that I want to implement Unit of
Let's say I have an ASP.NET MVC webapp that calls a repository layer, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.