Method assetlinks.check
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
确定指定的源资源和目标资源之间是否存在指定的(方向)关系。
这种关系描述了源资产对两项资产建立关联的意图。例如,特权或权限的委托就属于此类关系。
基础架构系统最常使用此命令来检查某项操作的前提条件。例如,客户端可能想要了解是否可以改为将网址发送到特定的移动应用。客户可以查看从网站指向移动应用的相关素材资源链接,以决定是否允许此操作。
有关安全性的注意事项:如果您指定一种安全资产(例如 HTTPS 网站或 Android 应用)作为来源,该 API 将确保用于生成响应的所有语句都由该资产的所有者通过安全的方式做出。反之,如果源资源是一个不安全的 HTTP 网站(即网址以 http://
而不是 https://
开头),则 API 将无法安全地验证其语句,也无法保证第三方更改了网站的语句。如需了解详情,请参阅 Digital Asset Links 技术设计规范。
HTTP 请求
GET https://digitalassetlinks.googleapis.com/v1/assetlinks:check
查询参数
参数名称 |
类型 |
说明 |
source |
object(Asset ) |
托管语句列表的来源。这用于将 Check() 调用路由到正确的来源。 |
relation |
string |
关系的查询字符串。 我们使用 <kind>/<detail> 格式的字符串来识别关系,其中 <kind> 必须是一组预定义的用途类别之一,而 <detail> 是自由格式的小写字母数字字符串,用于描述语句的具体用例。 如需查看受支持关系的最新列表,请参阅我们的 API 文档。 为使查询匹配资产链接,查询和资产链接的关系字符串必须完全匹配。 示例:关系为 delegate_permission/common.handle_all_urls 的查询与关系为 delegate_permission/common.handle_all_urls 的资产链接匹配。 |
target |
object(Asset ) |
语句的目标资产。 |
响应正文
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"linked": boolean,
"maxAge": string,
"debugString": string,
} |
字段名称 |
类型 |
说明 |
linked |
boolean |
如果请求中指定的资产与请求中指定的关系相关联,则设置为 true。必填 |
maxAge |
string |
自投放时间起,除非进一步更新,否则响应在多长时间内被视为有效。必填 该持续时间以秒为单位,最多包含九个小数位,以“s ”结尾。示例:"3.5s" 。 |
debugString |
string |
人类可读的消息,其中包含旨在帮助最终用户理解、重现和调试结果的信息。 该消息将采用英语,我们目前不打算提供任何翻译。 请注意,我们不对此字符串的内容或格式做出任何保证。条款的任何方面都可能会发生更改,恕不另行通知。您不应尝试以程序化方式解析此数据。如果您觉得需要这样做是因为 API 没有以其他方式提供您所需的信息,请首先与我们联系。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-06-26。
[null,null,["最后更新时间 (UTC):2024-06-26。"],[[["\u003cp\u003eVerifies the existence of a relationship between two digital assets, like websites and apps.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003eGET\u003c/code\u003e method with query parameters specifying the source, relation, and target assets.\u003c/p\u003e\n"],["\u003cp\u003eReturns a JSON response indicating if the assets are linked and provides additional debugging information.\u003c/p\u003e\n"],["\u003cp\u003ePrimarily used for security checks and ensuring the integrity of relationships between assets.\u003c/p\u003e\n"],["\u003cp\u003eOffers enhanced security when the source asset is secure (HTTPS or Android app).\u003c/p\u003e\n"]]],[],null,["# Method assetlinks.check\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.CheckResponse.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nDetermines whether the specified (directional) relationship exists between the specified source and target assets.\n\nThe relation describes the intent of the link between the two assets as claimed by the source asset. An example for such relationships is the delegation of privileges or permissions.\n\nThis command is most often used by infrastructure systems to check preconditions for an action. For example, a client may want to know if it is OK to send a web URL to a particular mobile app instead. The client can check for the relevant asset link from the website to the mobile app to decide if the operation should be allowed.\n\nA note about security: if you specify a secure asset as the source, such as an HTTPS website or an Android app, the API will ensure that any statements used to generate the response have been made in a secure way by the owner of that asset. Conversely, if the source asset is an insecure HTTP website (that is, the URL starts with `http://` instead of `https://`), the API cannot verify its statements securely, and it is not possible to ensure that the website's statements have not been altered by a third party. For more information, see the [Digital Asset Links technical design specification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).\n\n### HTTP request\n\n`GET https://digitalassetlinks.googleapis.com/v1/assetlinks:check`\n\n### Query parameters\n\n| Parameter name | Type | Description |\n|----------------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `source` | `object(`[Asset](/digital-asset-links/reference/rest/v1/Asset)`)` | The source hosting the statement list. This is used to route the `Check()` call to the proper source. |\n| `relation` | `string` | Query string for the relation. We identify relations with strings of the format `\u003ckind\u003e/\u003cdetail\u003e`, where `\u003ckind\u003e` must be one of a set of pre-defined purpose categories, and `\u003cdetail\u003e` is a free-form lowercase alphanumeric string that describes the specific use case of the statement. Refer to [our API documentation](/digital-asset-links/v1/relation-strings) for the current list of supported relations. For a query to match an asset link, both the query's and the asset link's relation strings must match exactly. Example: A query with relation `delegate_permission/common.handle_all_urls` matches an asset link with relation `delegate_permission/common.handle_all_urls`. |\n| `target` | `object(`[Asset](/digital-asset-links/reference/rest/v1/Asset)`)` | The target asset of the statement. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nResponse message for the CheckAssetLinks call.\n\n| JSON representation |\n|-------------------------------------------------------------------------|\n| ``` { \"linked\": boolean, \"maxAge\": string, \"debugString\": string, } ``` |\n\n| Field name | Type | Description |\n|---------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `linked` | `boolean` | Set to true if the assets specified in the request are linked by the relation specified in the request. REQUIRED |\n| `maxAge` | `string` | From serving time, how much longer the response should be considered valid barring further updates. REQUIRED A duration in seconds with up to nine fractional digits, terminated by '`s`'. Example: `\"3.5s\"`. |\n| `debugString` | `string` | Human-readable message containing information intended to help end users understand, reproduce and debug the result. The message will be in English and we are currently not planning to offer any translations. Please note that no guarantees are made about the contents or format of this string. Any aspect of it may be subject to change without notice. You should not attempt to programmatically parse this data. If you feel that you need to do this because the information you need is not otherwise exposed by the API, please contact us first. |\n\nTry it!\n-------\n\nUse the [APIs Explorer](https://developers.google.com/apis-explorer/?discovery_url=/digital-asset-links/v1/discoverydocument.json#p/digitalassetlinks/v1/digitalassetlinks.assetlinks.check?relation=delegate_permission%252Fcommon.handle_all_urls&source.web.site=https%253A%252F%252Fexample.digitalassetlinks.org&target.androidApp.certificate.sha256Fingerprint=10%253A39%253A38%253AEE%253A45%253A37%253AE5%253A9E%253A8E%253AE7%253A92%253AF6%253A54%253A50%253A4F%253AB8%253A34%253A6F%253AC6%253AB3%253A46%253AD0%253ABB%253AC4%253A41%253A5F%253AC3%253A39%253AFC%253AFC%253A8E%253AC1&target.androidApp.packageName=org.digitalassetlinks.sampleapp) to call this method on live data and see the response."]]