1

please tell me how to pass two parameter list to a method while post in postman api checker tool.

For Example-

public IHttpActionResult methodName ( List< int > para1, List< int > para2 )

In PostMan tool i have tried like below code in option raw {{"para1":[1,2,3]},{"para2":[2,3,4]}} and selected dropdown JSON(application/json).

but i am getting error like

{
  "Message": "An error has occurred.",
  "ExceptionMessage": "Can't bind multiple parameters ('para1' and 'para2') to the request's content.",
  "ExceptionType": "System.InvalidOperationException",
  "StackTrace": "   at System.Web.Http.Controllers.HttpActionBinding.ExecuteBindingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}

Tell me anyother way to pass the two parameter list.

1 Answer 1

2

I checked your JSON string in a validator and it showed an error. I changed it to this format and it passes:

[{ "name":[1,2,3]}, { "name":[1,2,3]}]

Check if this helps.

UPDATE The proper JSON is this:

{"para1":[1,2,3],"para2":[1,2,3]}

In the Postman, you need to select Raw->Json. Also make sure the request is POST, not GET.

It works perfectly on my side.

Sign up to request clarification or add additional context in comments.

1 Comment

Not working Bro, still showing the same error. can you please tell me what option did you select in dropdown(for example: Text or JSON or Javascript)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.