在向我的查询添加参数时,获得401错误(需要授权)。

时间:2021-10-03 12:18:01

I am trying to get a user contacts data through the Google Data API and am facing a problem: I get this 401 error message when I specify a parameter to my query (for ex in my case it's max-results=9999 as per query 1), while I can access the content (but limited to 25 entries...) with no pb when I don't add any query parameter (as per query 2).

我试图让用户通过Google数据API联系人数据,我面临一个问题:我得到这401错误消息当我指定一个参数来查询(前在我的情况下,每个查询的效果= 9999 1),虽然我可以访问的内容(但仅限于25个条目…)没有pb当我不添加任何查询参数(按查询2)。

Query 1: ...google's address.../m8/feeds/contacts/default/full?max-results=9999

查询1:……谷歌的地址…/ m8 / feed /联系人/违约/完整?效果= 9999

Query 2: ...google's address.../m8/feeds/contacts/default/full

查询2:……谷歌的地址…/ m8 / feed /联系人/违约/满的

(I tried with both simple http and https scopes and requests but same result...)

(我尝试了简单的http和https作用域和请求,但结果相同…)

I am using jrconlin's PHP oauthsimple library found here.

我正在使用jrconlin的PHP oauthsimple库。

https://github.com/jrconlin/oauthsimple/blob/master/php/example.php

https://github.com/jrconlin/oauthsimple/blob/master/php/example.php

Sorry guys if my question is trivial but I have been banging my head for a few hours now by rereading jrconlin's code and google's guide but really don't see where the mistake is!! Is there anything I'm missing?

抱歉,各位,如果我的问题很琐碎,但我已经读了几个小时jrconlin的代码和谷歌的指南,但真的不知道哪里出错了!有什么我遗漏的吗?

1 个解决方案

#1


0  

I think it is typical between different Google Products (not just Youtube or Sites, as cited below)

我认为这是不同谷歌产品之间的典型特征(不只是Youtube或网站,如下所示)

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_api_query_parameters.html

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_api_query_parameters.html

The max-results parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the start-index parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the max-results parameter to 10 and the start-index parameter to 11. The default value of this parameter is 25, and the maximum value is 50. However, for displaying lists of videos, we recommend that you set the max-results parameter to 10.

max-results参数指定结果集中应该包含的最大结果数,该参数与start-index参数一起工作,以确定返回哪个结果。例如,要请求第二组10个结果(即结果11-20),请将max-results参数设置为10,start-index参数设置为11。该参数的默认值为25,最大值为50。但是,对于显示视频列表,我们建议将max-results参数设置为10。

http://www.google.com/support/forum/p/apps-apis/thread?tid=781d988ee3fe2f09&hl=en

http://www.google.com/support/forum/p/apps-apis/thread?tid=781d988ee3fe2f09&hl=en

You must make multiple requests to get all pages in order to get all results. That is, you must follow each next link, and aggregate the results. We limit accepted values of max-results for performance reasons.

为了获得所有结果,必须发出多个请求才能获得所有页面。也就是说,您必须跟踪下一个链接,并聚合结果。由于性能原因,我们限制了最大结果的可接受值。

#1


0  

I think it is typical between different Google Products (not just Youtube or Sites, as cited below)

我认为这是不同谷歌产品之间的典型特征(不只是Youtube或网站,如下所示)

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_api_query_parameters.html

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_api_query_parameters.html

The max-results parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the start-index parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the max-results parameter to 10 and the start-index parameter to 11. The default value of this parameter is 25, and the maximum value is 50. However, for displaying lists of videos, we recommend that you set the max-results parameter to 10.

max-results参数指定结果集中应该包含的最大结果数,该参数与start-index参数一起工作,以确定返回哪个结果。例如,要请求第二组10个结果(即结果11-20),请将max-results参数设置为10,start-index参数设置为11。该参数的默认值为25,最大值为50。但是,对于显示视频列表,我们建议将max-results参数设置为10。

http://www.google.com/support/forum/p/apps-apis/thread?tid=781d988ee3fe2f09&hl=en

http://www.google.com/support/forum/p/apps-apis/thread?tid=781d988ee3fe2f09&hl=en

You must make multiple requests to get all pages in order to get all results. That is, you must follow each next link, and aggregate the results. We limit accepted values of max-results for performance reasons.

为了获得所有结果,必须发出多个请求才能获得所有页面。也就是说,您必须跟踪下一个链接,并聚合结果。由于性能原因,我们限制了最大结果的可接受值。