新的 Places API 会话令牌的有效期是多久? [英] How long do the new Places API session tokens last?

查看:29
本文介绍了新的 Places API 会话令牌的有效期是多久?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在多个页面上使用地址自动完成功能的网站——地址簿、送货地址、帐单邮寄地址.随着下个月发布的计费更改,我们可以将自动完成流程转换为使用会话而不是单个按键.(https://cloud.google.com/maps-platform/user-guide/pricing-changes/#billing-changes)

I have a website that uses address autocomplete on multiple pages--address book, shipping address, billing address. With the billing changes releasing next month, we can convert the Autocomplete process to use sessions instead of individual keystrokes. (https://cloud.google.com/maps-platform/user-guide/pricing-changes/#billing-changes)

  • AutocompleteSessionToken 的有效期是多久?当前页面?一小时?十二?永久地,它每次出现在新的月份时都会计入限制吗?
  • 如果会话令牌确实过期,而我们将令牌与请求一起发送,结果会是什么?如果客户将网页打开一天后又回来取用,而我们的会话数据尚未过期,我们如何确保他们不会收到自动完成错误?

推荐答案

据我所知,没有关于 Google Maps Platform 中 Places API 会话持续时间的官方文​​档.我可以分享一些从技术支持处获得的有关会话的信息,但是,它没有提供会话持续时间的确切值,而且 Google 似乎不会透露确切值.

As far as I can see there is no official documentation regarding session duration for Places API in Google Maps Platform. I can share some information about sessions obtained from the technical support, however, it doesn't provide exact value for session duration and it looks like Google won't reveal the exact value.

首先,如果您使用 Maps JavaScript API 的内置自动完成小部件,它会自动为您生成会话,因此无需担心.

First of all, if you use the built-in Autocomplete widget of Maps JavaScript API, it generates sessions for you automatically, so no need to worry about it.

如果您创建自己的小部件,您应该知道会话不会持续很长时间.自动完成会话包括一些自动完成请求(在用户键入时检索有关地点的建议)和至多一个地点详细信息请求(用于检索有关用户选择的地点的详细信息).

If you create your own widget, you should be aware that sessions do not last very long. An autocomplete session includes some Autocomplete requests (to retrieve suggestions on a place as the user types), and at most one Places Details request (to retrieve details about the place selected by the user).

相同的会话令牌被传递给自动完成和随后的地点详细信息请求.

The same session token is passed to the Autocomplete and the subsequent Place Detail request.

会话从第一个自动完成请求开始(通常发生在用户开始输入时).通常,在用户选择其中一项自动完成建议后,会调用 Places Details.

A session starts with the first Autocomplete request (which typically happens when the user starts typing). Typically, a Places Details call is made after the user has selected one of the Autocomplete suggestions.

在用户选择地点后(例如,进行地点详情调用),必须使用新会话令牌启动新会话.

After a user has selected a place (for example, a Places Details call is made), a new session must be started, with a new session token.

一个会话令牌不能用于多个用户会话.如果令牌被重复使用,会话将被视为无效,并且请求将按照未提供会话令牌的方式收费.

A session token cannot be used for more than one user session. If a token is reused, the session will be considered invalid and the requests will be charged as if no session token was provided.

如果会话令牌过期或失效,您将按击键次数付费.因此,每个自动完成请求都会被收费.

If session token is expired or invalidated you will be charged on the per keystroke basis. So each autocomplete request will be charged.

希望这些信息对您有用.

I hope you find this information useful.

这篇关于新的 Places API 会话令牌的有效期是多久?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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