Quickbooks 我在这个QBOV3报告API查询中做错了什么?
当我使用以下查询时,我得到了一个很好的回答(只有5月的前5天,因此显然默认值不是建议的“本财年迄今”,但我离题了): 当我添加参数时,我得到一个oauth异常。例如:Quickbooks 我在这个QBOV3报告API查询中做错了什么?,quickbooks,intuit-partner-platform,quickbooks-online,Quickbooks,Intuit Partner Platform,Quickbooks Online,当我使用以下查询时,我得到了一个很好的回答(只有5月的前5天,因此显然默认值不是建议的“本财年迄今”,但我离题了): 当我添加参数时,我得到一个oauth异常。例如: https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales?start_date='2013-01-01'&end_date='2014-05-06' 给我这个: { "Fault": { "type": "AUTHEN
https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales?start_date='2013-01-01'&end_date='2014-05-06'
给我这个:
{
"Fault": {
"type": "AUTHENTICATION",
"Error": [
{
"Message": "message=Exception authenticating OAuth; errorCode=003200; statusCode=401",
"code": "3200"
}
]
},
"requestId": "[redacted]",
"time": "[redacted]"
}
这给了我同样的结果:
https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales?date_macro='This Fiscal Year'
这也是:
https://quickbooks.api.intuit.com/v3/company/148305798/reports/CustomerSales?accounting_method='Accrual'
我想我错过了一些小东西。我没有更改任何标题或任何其他请求详细信息…只是更改url
我试着在日期和其他参数周围没有单引号
我在破坏什么?我已经使用java devkit尝试了这个报告。 这对我很管用。PFB详细信息 请求URI-
https://quickbooks.api.intuit.com/v3/company/1092175540/reports/CustomerSales?accounting_method=Accrual&start_date=2014-01-01&requestid=61234ddb7e14ce2a5fe4e2f0318b31c&minorversion=1&
我的测试公司文件为空。。这就是为什么会得到下面的JSON响应
{
"Header":{
"Time":"2014-05-06T20:42:08.783-07:00",
"ReportName":"CustomerSales",
"ReportBasis":"Accrual",
"StartPeriod":"2014-05-01",
"EndPeriod":"2014-05-06",
"SummarizeColumnsBy":"Total",
"Currency":"USD"
},
"Columns":{
"Column":[
{
"ColTitle":"",
"ColType":"Customer"
}
]
},
"Rows":{
"Row":[
{
"ColData":[
{
"value":"TOTAL"
}
],
"group":"GrandTotal"
}
]
}
}
JAVA代码
void testCustomerSalesReport(Context context) {
Config.setProperty(Config.SERIALIZATION_RESPONSE_FORMAT, "json");
ReportService service = new ReportService(context);
service.setStart_date("2014-01-01");
service.setAccounting_method("Accrual");
Report report = null;
try {
report = service.executeReport(ReportName.CUSTOMERSALES.toString());
} catch (FMSException e) {
e.printStackTrace();
}
}
API文件Ref-
希望它会有用
谢谢您是否将数据包括在页面右侧?在“基本”字符串中的URL中,您是否将其与其他参数一起排序?我正在将其包含在传递给请求的基本字符串中……我想我理解您的意思,并将尝试将参数作为**kwargs发送,而不是在基本URL中,我们将查看它是否有效。这正是问题所在。我用params关键字传递参数,而不是直接将它们构建到url上,这就解决了问题。非常感谢!
void testCustomerSalesReport(Context context) {
Config.setProperty(Config.SERIALIZATION_RESPONSE_FORMAT, "json");
ReportService service = new ReportService(context);
service.setStart_date("2014-01-01");
service.setAccounting_method("Accrual");
Report report = null;
try {
report = service.executeReport(ReportName.CUSTOMERSALES.toString());
} catch (FMSException e) {
e.printStackTrace();
}
}