3

Contacts API v3、グループ クエリ パラメータは「q」パラメータをサポートしていませんか??? Google Contacts API v3 では、サポートされていることが明確に示されています。しかし、Google が提供する Java クライアント ライブラリを使用して、クエリで setFullTextQuery によってコントラクト グループを検索すると、HTTP ステータス 403 Forbidden が返されます。「スレッド「メイン」com.google.gdata.util.ServiceForbiddenException の例外: Forbidden このサービスは「q」パラメーターをサポートしていません」をスローします。

最新の Java クライアント ライブラリをダウンロードしました: GDATA 用の GData-Java/1.47.1(gzip)。連絡先グループを検索するには、setFullTextQuery メソッドを使用してみてください。

問題を再現する手順は何ですか?

  1. Java サンプル連絡先の設定
  2. ContactsExample.java の queryEntries メソッドで、新しい行を追加します。myQuery.setFullTextQuery("ここに検索用語");
  3. そして、それを実行します

バージョンが正しいことを確認しました。GData-Version: 3.0 を使用しています。提供されているサンプル Java を実行すると、すべて正常に動作します。しかし、連絡先を検索する必要があります。そして、「q」パラメーターを使用するのが正しいアプローチです。

助けてください。ライブラリに問題があるのでしょうか、それとも別の方法で連絡先を検索する必要がありますか?

以下のログ:

実行アクション: QUERY

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest setPrivateHeader FINER: 承認:

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest setHeader FINER: ユーザー エージェント: Google-contactsExampleApp-3 GContacts-Java/3.1.0 GData-Java/1.47.1(gzip)

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest setHeader FINER: Accept-Encoding: gzip

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest setHeader FINER: GData-Version: 3.0

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINE を実行: 403 禁止

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: null: HTTP/1.1 403 禁止

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: X-Frame-Options: SAMEORIGIN

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 実行 FINER: Transfer-Encoding: チャンク

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 実行 FINER: 日付: 2012 年 11 月 28 日水曜日 17:38:48 GMT

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 実行 FINER: 期限切れ: 2012 年 11 月 28 日水曜日 17:38:48 GMT

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: X-XSS-Protection: 1; モード=ブロック

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 実行 FINER: コンテンツ エンコーディング: gzip

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: コンテンツ タイプ: テキスト/html; 文字セット=UTF-8

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: サーバー: GSE

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: キャッシュ コントロール: プライベート、最大年齢 = 0

2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest FINER を実行: X-Content-Type-Options: nosniff

スレッド「メイン」の例外 com.google.gdata.util.ServiceForbiddenException: Forbidden このサービスは「q」パラメータをサポートしていません。

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:605)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:1077)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
at com.google.gdata.client.Service.query(Service.java:1237)
at com.google.gdata.client.Service.query(Service.java:1178)
at sample.contacts.ContactsExample.queryEntries(ContactsExample.java:406)
at sample.contacts.ContactsExample.processAction(ContactsExample.java:350)
at sample.contacts.ContactsExample.main(ContactsExample.java:626)

Java 結果: 1

4

2 に答える 2

0

コードを投稿していないので、ここではロングショットです...

クエリを実行するユーザーを認証および設定していないようです。

IE では、クエリに次を追加する必要がある場合があります。

myQuery.addCustomParameter(
    new Query.CustomParameter("xoauth_requestor_id"
        , username)); //where username is the authenticated (probably by OAuth) user

私が助けてくれることを願っています..

于 2013-01-28T12:45:25.380 に答える
0

これは機能します:

https://www.google.com/m8/feeds/contacts/default/full?v=3.0&alt=json&q=john&max-results=10&orderby=lastmodified&sortorder=descending

v=3.0全文検索には が必須であることに注意してください。

于 2016-09-03T08:09:26.797 に答える