please tell me how to pass two parameter list to a method while post in postman api checker tool.
请告诉我如何在postman api checker工具中发布时将两个参数列表传递给方法。
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)
.
在PostMan工具中,我在选项raw {{“para1”:[1,2,3]},{“para2”:[2,3,4]}}和选定的下拉列表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
I checked your JSON string in a validator and it showed an error. I changed it to this format and it passes:
我在验证器中检查了您的JSON字符串,但显示错误。我将其更改为此格式并通过:
[{ "name":[1,2,3]}, { "name":[1,2,3]}]
Check if this helps.
检查这是否有帮助。
UPDATE The proper JSON is this:
更新正确的JSON是这样的:
{"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.
在Postman中,您需要选择Raw-> Json。还要确保请求是POST,而不是GET。
It works perfectly on my side.
它完美地在我身边。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2017/01/21/71d59b4892eb27063637266a199988f0.html。