我正在与Xena api
合作即使我具有有效的访问令牌,也无法从api获取数据。
https://my.xena.biz/Api/User/XenaUserMembership
返回
{
"Message": "An error has occurred.",
"ExceptionMessage": "Object reference not set to an instance of an object.",
"ExceptionType": "System.NullReferenceException",
"StackTrace": " at Xena.Web.Api.ApiUserController.GetXenaUserMembershipList(ListOptions listOptions, String queryString) in C:\\Development\\Xena\\Xena\\src\\Xena.Web\\Api\\ApiUserController.cs:line 249\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\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.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.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.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.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.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.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.Controllers.ActionFilterResult.<ExecuteAsync>d__5.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__15.MoveNext()"
}
然后我发现页面大小是必填字段。
https://my.xena.biz/Api/User/XenaUserMembership?PageSize=1
结果
"Count": 72,
"Entities": [
{
"Id": 1,
"MembershipId": 8326,
"FiscalSetupId": 7,
"UserId": 52522,
"ResourceId": 832544,
"ResourceName": "XXX XXXX",
"ResourceTheme": "theme-default",
"CurrencyAbbreviation": "DKK",
"FiscalSetupName": "TestCompany",
"VCardId": 54544,
"XenaSubscriptionId": 832140,
"SproomKey": null,
"PictureLastVersionId": 5427538,
"PictureUrl": "/Blob/Public/VCard/54544/Thumbnail/5427538",
"SecurityGroups": "Admin"
}
]
}
我不是记录程序遇到错误,但我想获取全部结果。它说count = 72我如何获得所有72个对象的完整列表?
答案 0 :(得分:0)
深入研究文档后,我终于找到了。 ForceNoPaging = true,当添加到请求末尾时,它将返回完整的响应。
https://my.xena.biz/Api/User/XenaUserMembership?ForceNoPaging=true