Danh sách hoặc đoạn mã câu lệnh bao gồm một mảng JSON gồm một hoặc nhiều câu lệnh về trang web hoặc ứng dụng dưới dạng các đối tượng JSON. Các câu lệnh này có thể theo thứ tự bất kỳ. Sau đây là cú pháp chung:
Một mảng gồm một hoặc nhiều chuỗi mô tả mối quan hệ đang được khai báo cho mục tiêu. Xem danh sách các chuỗi mối quan hệ được xác định. Ví dụ:delegate_permission/common.handle_all_urls
mục tiêu
Thành phần mục tiêu mà câu lệnh này áp dụng. Các loại mục tiêu có thể dùng:
URI của trang web là mục tiêu của câu lệnh, ở định dạng http[s]://<hostname>[:<port>], trong đó <hostname> đủ điều kiện và <port> phải được bỏ qua khi sử dụng cổng 80 cho HTTP hoặc cổng 443 cho HTTPS. Đích đến là trang web chỉ có thể là miền gốc; bạn không thể giới hạn ở một thư mục con cụ thể; tất cả các thư mục trong miền gốc này sẽ khớp. Miền con không được coi là khớp: tức là nếu tệp kê khai được lưu trữ trên www.example.com, thì www.puppies.example.com không được coi là khớp. Để biết các quy tắc và ví dụ về việc so khớp mục tiêu trên trang web, hãy xem tài liệu về mục tiêu. Ví dụ:http://www.example.com
Tên gói đủ điều kiện của ứng dụng mà câu lệnh này áp dụng. Ví dụ:com.google.android.apps.maps
sha256_cert_fingerprints
Dấu vân tay SHA256 viết hoa của chứng chỉ cho ứng dụng mà câu lệnh này áp dụng. Bạn có thể tính toán điều này bằng cách sử dụng
openssl hoặc Java keytool như minh hoạ dưới đây:
Nếu bạn đang sử dụng Tính năng ký ứng dụng của Play cho ứng dụng, thì dấu vân tay chứng chỉ do việc chạy keytool hoặc openssl cục bộ tạo ra thường không khớp với dấu vân tay trên thiết bị của người dùng. Bạn có thể xác minh xem bạn có đang dùng tính năng Ký ứng dụng Play cho ứng dụng của mình trong tài khoản nhà phát triển trên Play Console ở phần Release > Setup > App Integrity hay không; nếu có, thì bạn cũng sẽ thấy đoạn mã JSON chính xác của Đường liên kết đến tài sản kỹ thuật số cho ứng dụng của mình trên cùng một trang.
relation_extensions (không bắt buộc)
Bạn có thể thêm trường relation_extensions (không bắt buộc) vào một câu lệnh để cung cấp thêm thông tin về các quyền và mối liên kết mà bạn muốn cấp. Trường này phải là một đối tượng, trong đó mỗi khoá là một chuỗi mối quan hệ và giá trị là một đối tượng chứa các tiện ích cho mối quan hệ đó. Bạn cần cập nhật những ứng dụng yêu cầu các câu lệnh này để tuân thủ các trường này.
Ví dụ: relation_extensions cho mối quan hệ delegate_permission/common.handle_all_urls có thể trông như sau:
Trong một số trường hợp, một chủ thể có thể muốn đưa ra nhiều tuyên bố khác nhau về các mục tiêu khác nhau, hoặc có thể cần đưa ra tuyên bố từ nhiều chủ thể khác nhau cho cùng một nhóm mục tiêu. Ví dụ: một trang web có thể có nhiều Miền cấp cao nhất theo quốc gia và tất cả các miền này đều có thể muốn đưa ra một tuyên bố về cùng một ứng dụng di động.
Trong những trường hợp này, câu lệnh include có thể hữu ích.
Bằng cách sử dụng cơ chế này, bạn có thể thiết lập con trỏ từ nhiều đối tượng chính khác nhau đến một vị trí trung tâm, xác định các câu lệnh cho tất cả các đối tượng chính.
Ví dụ: bạn có thể quyết định rằng vị trí trung tâm phải là "https://example.com/includedstatements.json". Bạn có thể định cấu hình tệp này để chứa nội dung giống như trong các ví dụ ở trên.
Để thiết lập một con trỏ từ trang web đến tệp include, hãy thay đổi "https://example.com/.well-known/assetlinks.json" thành:
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-09 UTC."],[[["\u003cp\u003eA statement list is a JSON file that describes relationships between websites and Android apps, used for features like Digital Asset Links.\u003c/p\u003e\n"],["\u003cp\u003eThe list consists of statements with "relation" and "target" fields, where "target" can be a website or an Android app.\u003c/p\u003e\n"],["\u003cp\u003eWebsite targets are specified using a "site" field with a URL, while Android app targets use "package_name" and "sha256_cert_fingerprints".\u003c/p\u003e\n"],["\u003cp\u003eFor many statements, use "include" to point to a central file to avoid redundancy and simplify management.\u003c/p\u003e\n"],["\u003cp\u003eDetailed syntax and examples are provided to guide you in creating and using statement lists effectively.\u003c/p\u003e\n"]]],[],null,["A statement list is a [JSON-encoded](http://json.org/) file or snippet in a well-known location.\n\nLocation of statement list\n\nSee [Creating a statement list](/digital-asset-links/v1/create-statement) to learn where this list should be stored.\n\nSyntax\n\nThe statement list or snippet consists of\na JSON array of one or more website or app statements as JSON objects. These statements can be in any order. Here is the general syntax: \n\n```\n[\n {\n \"relation\": [\"relation_string\"],\n \"target\": {target_object}\n } , ...\n]\n```\n\nrelation\n: An array of one or more strings that describe the relation being declared about the target. See the list of [defined relation strings](/digital-asset-links/v1/relation-strings). **Example:** `delegate_permission/common.handle_all_urls`\n\ntarget\n: The target asset to whom this statement applies. Available target types:\n\n - **Website target** \n\n ```javascript\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"\u003cvar translate=\"no\"\u003esite_root_url\u003c/var\u003e\"\n }\n ```\n\n namespace\n : Must be `web` for websites.\n\n site\n : URI of the site that is the target of the statement, in the format `http[s]://\u003c`\u003cvar translate=\"no\"\u003ehostname\u003c/var\u003e`\u003e[:\u003c`\u003cvar translate=\"no\"\u003eport\u003c/var\u003e`\u003e]`, where \u003cvar translate=\"no\"\u003e<hostname>\u003c/var\u003e is fully-qualified, and \u003cvar translate=\"no\"\u003e<port>\u003c/var\u003e must be omitted when using port 80 for HTTP, or port 443 for HTTPS. A website target can only be a root domain; you cannot limit to a specific subdirectory; all directories under this root will match. Subdomains should not be considered to match: that is, if the statement file is hosted on www.example.com, then www.puppies.example.com should not be considered a match. For rules and examples about website target matching, see [the targets documentation](/digital-asset-links/v1/create-statement#targets). **Example:** `http://www.example.com`\n - **Android app target** \n\n ```javascript\n \"target\": {\n \"namespace\": \"android_app\",\n \"package_name\": \"\u003cvar translate=\"no\"\u003efully_qualified_package_name\u003c/var\u003e\",\n \"sha256_cert_fingerprints\": [\"\u003cvar translate=\"no\"\u003ecert_fingerprint\u003c/var\u003e\"]\n }\n ```\n\n namespace\n : Must be `android_app` for Android apps.\n\n package_name\n : The fully-qualified package name of the app that this statement applies to. **Example:** `com.google.android.apps.maps`\n\n sha256_cert_fingerprints\n : The **uppercase SHA265 fingerprint** of the certificate for the app that this\n statement applies to. You can compute this using [`\n openssl`](https://www.openssl.org/) or Java `keytool` as shown here:\n - `openssl x509 -in $CERTFILE -noout -fingerprint -sha256`\n - `keytool -printcert -file $CERTFILE | grep SHA256`\n\n\n **Example:** `[\"14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\"]`.\n\n If you're using [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756)\n for your app, then the certificate fingerprint produced by running `keytool`\n or `openssl` locally usually doesn't match the one on\n users' devices. You can verify whether you're using Play App Signing for your app in your\n [Play Console](https://play.google.com/console/) developer account\n under **Release \\\u003e Setup \\\u003e App Integrity**; if you do,\n then you'll also find the correct Digital Asset Links JSON snippet for your app on the same\n page.\n\nrelation_extensions (optional)\n\n: You can add an optional `relation_extensions` field to a statement to provide more information on the permissions and associations you want to grant. This field should be an object where each key is a relation string, and the value is an object containing the extensions for that relation. Clients that request these statements need to be updated to respect these fields.\n\n For example, `relation_extensions` for the `delegate_permission/common.handle_all_urls` relation may look like: \n\n ```javascript\n {\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"android_app\",\n \"package_name\": \"com.example.app\",\n \"sha256_cert_fingerprints\": [\"...\"]\n },\n \"relation_extensions\": {\n \"delegate_permission/common.handle_all_urls\": {...}\n }\n }\n \n ```\n\n The DAL API supports returning relation_extensions in API calls when the `return_relation_extensions=true` parameter is set in the request.\n\nExample statement list\n\nHere is an example website statement list that contains statements about both websites and apps: \u003chttp://example.digitalassetlinks.org/.well-known/assetlinks.json\u003e\n\nScaling to dozens of statements or more\n\nIn some cases, a principal might want to make many different statements\nabout different targets, or there might be a need to issue statements from\ndifferent principals to the same set of targets. For example, a website may\nbe available on many different per-country Top Level Domains, and all of them\nmay want to make a statement about the same mobile app.\n\nFor these situations, **include statements** can be helpful.\nUsing this mechanism, you can set up pointers from many different principals to\none central location, which defines statements for all of the principals.\n| **Note:** A maximum of 10 include statements are allowed in a complete statement list tree. This means that the maximum number of files in the tree is: (10 included statement files) + (the root statement file) = 11 total.\n\nFor example, you might decide that the central location\nshould be \\`https://example.com/includedstatements.json\\`. This file can be\nconfigured to contain the same content as in the examples above.\n\nTo set up a pointer from a **web site** to the include file,\nchange \\`https://example.com/.well-known/assetlinks.json\\` to: \n\n```text\n[{\n \"include\": \"https://example.com/includedstatements.json\"\n}]\n```\n\nTo set up a pointer from an **Android app** to the include\nfile, change \\`res/values/strings.xml\\` to: \n\n```scdoc\n\u003cresources\u003e\n ...\n \u003cstring name=\"asset_statements\"\u003e\n [{\n \\\"include\\\": \\\"https://example.com/includedstatements.json\\\"\n }]\n \u003c/string\u003e\n\u003c/resources\u003e\n```\n\nMore Information\n\nThere is a more detailed explanation of the statement list format and the underlying concepts in our [specification document](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md)."]]