doubiao7267 2016-04-23 22:54
浏览 28
已采纳

无法调用QuickBooks“查询”端点

I've got OAuth working for creating a customer then loading that customer via their customer ID

However when I try to use the "query" endpoint to find a customer by name, it fails me.

I'm using Laravel and the PHPoAuthLib library. My code looks like so:

$oauth = OAuth::consumer('QuickBooks');
$oauth_token = unserialize(file_get_contents(storage_path("tokens/saved_data.txt")));

$storage = $oauth->getStorage();
$storage->storeAccessToken('QuickBooks', $oauth_token['access_token']);

// Check for Quickbooks donor
$result = $oauth->request("/v3/company/" . $oauth_token['company_id'] . "/query?query=SELECT * FROM Customer MAXRESULTS 1", "GET");

return $result;

This is returning a 400 error with the message "Unknown Version"

Trying to google this error suggests it might be an issue in signature generation.

  • 写回答

1条回答 默认 最新

  • duanqiao3608 2016-05-14 16:40
    关注

    I actually figured out the issue with this about two weeks ago -- updating with the answer I found:

    The query needs to be URL encoded. I changed it to the following:

    $result = $oauth->request("/v3/company/" . $oauth_token['company_id'] . "/query?query=" . urlencode("SELECT * FROM Customer MAXRESULTS 1"), "GET");
    

    Everything worked perfectly

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用