LoginSignup
0
0

More than 1 year has passed since last update.

Google Calendar APIでnextSyncTokenが返らないときの対策

Last updated at Posted at 2021-07-12

EventsなどのList APIでnextSyncTokenがなぜか返ってこないとき、APIの呼び出し方に問題があります。
以下の条件を満たすようにAPIを呼びます。

nextSyncTokenが返るための条件

  • 一部のクエリパラメータを使わない
    • showDeletedをfalseにしたり、timeMinを使うとBad Requestになる
      • Sync token cannot be used with other request restrictions., syncTokenWithRequestRestrictions
  • pagingしていない
    • クエリ結果の件数が多いとpagingが必要で、代わりにnextPageTokenが返る
    • syncTokenを渡し忘れていると、意図せず結果が多くなりpagingが発生することも

その他

  • 実際は返っているが、名前が似たpageTokenを間違えて参照している
  • 結果が0件のときは、同じ値のtokenが返る
  • 最新ではないがexpireしていないsyncTokenを使っても正常に返る
    • expireしていると410 Goneが返る

リファレンス

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0