QuickBooks Online 使用过滤器查询每次都返回 401 [英] QuickBooks Online querying with filter returns 401 everytime

查看:53
本文介绍了QuickBooks Online 使用过滤器查询每次都返回 401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用 POST 和 Content-Type application/xml 创建对象

I've had success creating objects with POST and Content-Type application/xml

我还成功地使用 Content-Type application/x-www-form-urlencoded 查询并使用空白请求正文返回所有对象类型,具体取决于我指定的 URI.

I've also had success querying using Content-Type application/x-www-form-urlencoded with a blank request body which returns all of the object type depending on which URI I specify.

我也可以在请求正文中使用类似 PageNum=1&ResultsPerPage=1 之类的内容,并且我已经弄清楚如何将其合并到签名中,以便获得有效响应.

I can also get the same to work with something like PageNum=1&ResultsPerPage=1 in the request body and I have figured out how to incorporate that into the signature so I get a valid response.

但是,无论我如何格式化它,当我尝试使用过滤器时,除了 401 响应之外,我什么也得不到(一些基本的东西,比如 Filter=FAMILYNAME :EQUALS: Doe).我已经阅读了 OAuth Core 1.0 Revision A 规范,了解如何使用 [RFC3986] 百分比编码对所有参数名称和值进行转义.但是我觉得我错过了一个步骤或格式不正确.我在 Intuit 的论坛中搜索有关正确格式的信息时发现不一致的信息.

However no matter how I format it, I cannot get anything other than a 401 response when I try to use a filter (something basic like Filter=FAMILYNAME :EQUALS: Doe). I've read over the OAuth Core 1.0 Revision A specifications on how all parameter names and values are escaped using the [RFC3986] percent-encoding. However I feel like I'm missing a step or formatting incorrectly. I've seen inconsistent information in my searching through Intuit's forums on what exactly is the proper format.

对此的任何帮助将不胜感激.我已经为此苦苦挣扎了一个星期.

Any help on this would be greatly appreciated. I've been struggling with this for a good week now.

我在尝试使用过滤器时得到的响应是:HTTP 状态 401 - message=OAuth 身份验证异常;错误代码=003200;状态代码=401

The response I get when trying to use a filter is: HTTP Status 401 - message=Exception authenticating OAuth; errorCode=003200; statusCode=401

----更新----

当我尝试将过滤器与新 IPP 开发人员工具 - IPP API Explorer 结合使用时,我看到了同样的错误.我正在使用 IDS V2 QBO API Explorer.我可以使用该工具来检索所有帖子,并且响应显示了我的所有客户,但是当我尝试使用过滤器时,我得到:服务器错误401 - 未经授权:由于凭据无效,访问被拒绝.您无权使用您提供的凭据查看此目录或页面.

I'm am seeing the same error when I try to use filters with the New IPP Developer Tools - IPP API Explorer. I'm using the IDS V2 QBO API Explorer. I'm able to use that tool to do a retrieve all Post and the response shows all of my customers, but when I try to use a filter I get : Server Error 401 - Unauthorized: Access is denied due to invalid credentials. You do not have permission to view this directory or page using the credentials that you supplied.

有什么想法吗?如果我从 API Explorer 工具中得到同样的错误,我就会认为问题完全是另外一回事.

Any Ideas? If I'm getting the same error from the API Explorer tool, it makes me think the problem is something else entirely.

----最终更新----

----Final Update----

我终于在过滤器方面取得了成功,我相信我已经弄清楚我的问题是什么.我总是怀疑我能够使用PageNum=1&ResultsPerPage=1"这样的分页查询来工作,但无法获得Filter=FAMILYNAME :EQUALS: Doe"之类的查询.我怀疑过滤器格式中的空白有问题.之前让我无法追踪的原因是我无法让过滤器在 IDS V2 QBO API Explorer 中工作.这让我怀疑还有其他事情发生.我决定完全忽略 API Explorer,专注于为什么我可以让它以一种方式工作,而不能以另一种方式工作.

I have finally had success with filters and I believe I have figure out what my problem was. I was always suspicious that I was able to get queries with pagination like "PageNum=1&ResultsPerPage=1" to work, but could not get something like "Filter=FAMILYNAME :EQUALS: Doe". I suspected there problem was with the white space in the filter format. What threw me off tracking this down earlier was that I could not get the filters to work in the IDS V2 QBO API Explorer. That made me suspect there was something else going on. I decided to ignore the API Explorer all together and focus on why I could get it to work the one way but no the other.

我相信我的问题归结为签名中过滤器值的不正确编码.这解释了我收到的 401 无效签名错误.

I believe my problem came down to improper encoding of the Filter's value in the signature. That explains the 401 invalid signature errors I was getting.

Filter=Name :EQUALS: Doe"在标准化后变为Filter=Name%20%3AEQUALS%20%3ADoe".

"Filter=Name :EQUALS: Doe" becomes "Filter=Name%20%3AEQUALS%20%3ADoe" after normalization.

应该给出Filter%3DName%2520%253AEQUALS%2520%253ADoe"的百分比编码.

Percent-Encoding that should give "Filter%3DName%2520%253AEQUALS%2520%253ADoe".

本质上,您必须对空格和冒号进行双重"编码,而不是对等号进行双重"编码.我尝试了许多进行编码的排列,但相信我的错误是我不是双重"编码,或者当我进行双重编码时,我包含了="符号.无论哪种方式都会破坏您的签名.感谢大家的投入.

In essence you have to "double" encode the blank space and the colons, but not the equal sign. I tried many permutations of doing the encoding, but believe my mistake was that I was either not "double" encoding, or when I was double encoding I was including the '=' sign. Either way breaks your signature. Thanks for everyone's input.

推荐答案

我相信我的问题归结为签名中过滤器值的不正确编码.这解释了我收到的 401 无效签名错误.

I believe my problem came down to improper encoding of the Filter's value in the signature. That explains the 401 invalid signature errors I was getting.

我使用在线工具引导我完成正确签署 Oauth 请求的步骤.在执行这些步骤时,我意识到我的问题在于规范化请求参数然后对它们进行百分比编码的步骤.我在标准化步骤中包含了过滤器的=",这会破坏您的签名.我使用的工具可以在以下位置找到:

I used an online tool to take me through the steps in properly signing an Oauth request. While going through those steps I realized my problem was with the steps where you normalize the request parameters and then percent-encode them. I was including the '=' of the filter in the normalization step, which breaks your signature. The tool I used can be found at:

http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/

感谢大家的投入.

这篇关于QuickBooks Online 使用过滤器查询每次都返回 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆