QBO -在specificyoperatoroption查询过滤器中发布
本文关键字:过滤器 查询 specificyoperatoroption QBO | 更新日期: 2023-09-27 18:19:15
Code :
Intuit.Ipp.Data.Qbo.AccountQuery qboAccQuery = new Intuit.Ipp.Data.Qbo.AccountQuery();
qboAccQuery.CreateTime = DateTime.Now.Date.AddDays(-20);
qboAccQuery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.AFTER);
qboAccQuery.CreateTime = DateTime.Now.Date;
qboAccQuery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.BEFORE);
qboAccQuery.PageNumber = 1;
qboAccQuery.ResultsPerPage = 15;
List<Intuit.Ipp.Data.Qbo.Account> qboAccounts =
qboAccQuery.ExecuteQuery<Intuit.Ipp.Data.Qbo.Account> (co ntext).ToList<Intuit.Ipp.Data.Qbo.Account>();
get this request body Filter=CreateTime:AFTER: 2013-06-19T15:28:56+05:30 &类型= CreateTime AToZ& PageNum = 1, ResultsPerPage = 100
但它生成异常InvalidTokenException: {"Unauthorized"}
Exception :
Intuit.Ipp.Exception.InvalidTokenException was caught
HResult=-2146233088
Message=Unauthorized
Source=System
ErrorCode=401
StackTrace:
at Intuit.Ipp.Exception.IdsExceptionManager.HandleException(IdsException idsException)
at Intuit.Ipp.Services.QboService.Get[T](IQboQuery qboQuery, String simpleQuery, Boolean isQuerySpecified)
at Intuit.Ipp.Services.ServiceExtensions.ExecuteQuery[T](IQuery query, ServiceContext serviceContext)
at QbSync.QuickBooksCustomers.Page_Load(Object sender, EventArgs e)
SDK没有正确编码请求体,因此您需要使用DevDefined并使用SDK对响应进行反序列化。代码示例:https://gist.github.com/IntuitDeveloperRelations/6024616