문제

When I use the following query, I get a good response (with only the first 5 days of May, so apparently the default is not 'This Fiscal Year-to-date' as the documentation suggests, but I digress):

https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales

When I add parameters, I get an oauth exception. For example:

https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales?start_date='2013-01-01'&end_date='2014-05-06'

Gives me this:

{
 "Fault": {
  "type": "AUTHENTICATION", 
  "Error": [
   {
    "Message": "message=Exception authenticating OAuth; errorCode=003200; statusCode=401", 
    "code": "3200"
   }
   ]
 }, 
 "requestId": "[redacted]", 
 "time": "[redacted]"
}

This gives me the same result:

https://quickbooks.api.intuit.com/v3/company/0123456789/reports/CustomerSales?date_macro='This Fiscal Year'

So does this:

https://quickbooks.api.intuit.com/v3/company/148305798/reports/CustomerSales?accounting_method='Accrual'

I figure I'm missing something small. I'm not changing any of the headers or any of the other request details...just the url.

I tried without the single quotes around the dates and other params too.

What am I breaking?

도움이 되었습니까?

해결책

Are you including the data to the right of the ? in the URL in the "base" string and are you sorting it with the other parameters?

다른 팁

I've tried this report using java devkit. It worked fine for me. PFB details.

Request URI - https://quickbooks.api.intuit.com/v3/company/1092175540/reports/CustomerSales?accounting_method=Accrual&start_date=2014-01-01&requestid=61234ddb7e14ce2a5fe4e2f0318b31c&minorversion=1&

My test company file is empty.. That's why got the following JSON response.

{
   "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 code

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 Doc Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/reports/customersales

Hope it will be useful.

Thanks

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top