Method assetlinks.check
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Xác định xem liệu mối quan hệ (định hướng) được chỉ định có tồn tại giữa tài sản nguồn và tài sản mục tiêu được chỉ định hay không.
Mối quan hệ mô tả mục đích liên kết giữa hai tài sản như đã được tài sản nguồn xác nhận quyền sở hữu. Một ví dụ cho các mối quan hệ như vậy là việc uỷ quyền đặc quyền hoặc cấp quyền.
Lệnh này thường được các hệ thống cơ sở hạ tầng sử dụng để kiểm tra các điều kiện tiên quyết cho một hành động. Ví dụ: một khách hàng có thể muốn biết liệu có nên gửi URL web đến một ứng dụng di động cụ thể hay không. Khách hàng có thể kiểm tra đường liên kết đến thành phần có liên quan từ trang web đến ứng dụng di động để quyết định xem có cho phép hoạt động này hay không.
Lưu ý về tính bảo mật: nếu bạn chỉ định một thành phần bảo mật làm nguồn, chẳng hạn như một trang web HTTPS hoặc một ứng dụng Android, thì API sẽ đảm bảo rằng mọi câu lệnh dùng để tạo phản hồi đều được chủ sở hữu của tài sản đó đưa ra một cách an toàn. Ngược lại, nếu thành phần nguồn là một trang web HTTP không bảo mật (tức là URL bắt đầu bằng http://
thay vì https://
), thì API không thể xác minh các tuyên bố của trang web một cách an toàn và không thể đảm bảo rằng các tuyên bố của trang web không bị bên thứ ba thay đổi. Để biết thêm thông tin, hãy xem Quy cách thiết kế kỹ thuật của Đường liên kết đến tài sản kỹ thuật số.
Yêu cầu HTTP
GET https://digitalassetlinks.googleapis.com/v1/assetlinks:check
Tham số truy vấn
Tên thông số |
Loại |
Nội dung mô tả |
source |
object(Asset ) |
Nguồn lưu trữ danh sách bảng sao kê. Mã này dùng để định tuyến lệnh gọi Check() đến nguồn phù hợp. |
relation |
string |
Chuỗi truy vấn cho mối quan hệ. Chúng ta xác định mối quan hệ bằng các chuỗi có định dạng <kind>/<detail> , trong đó <kind> phải là một trong tập hợp các danh mục mục đích được xác định trước và <detail> là một chuỗi chữ và số viết thường dạng tự do mô tả trường hợp sử dụng cụ thể của câu lệnh. Hãy tham khảo tài liệu về API của chúng tôi để biết danh sách các mối quan hệ được hỗ trợ hiện tại. Để một truy vấn khớp với đường liên kết tài sản, chuỗi quan hệ của cụm từ tìm kiếm và đường liên kết tài sản phải khớp chính xác. Ví dụ: Truy vấn có quan hệ delegate_permission/common.handle_all_urls khớp với một đường liên kết đến tài sản có quan hệ delegate_permission/common.handle_all_urls . |
target |
object(Asset ) |
Thành phần mục tiêu của câu lệnh. |
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Thông báo phản hồi cho cuộc gọi CheckAssetLinks.
Biểu diễn dưới dạng JSON |
{
"linked": boolean,
"maxAge": string,
"debugString": string,
} |
Tên trường |
Loại |
Nội dung mô tả |
linked |
boolean |
Đặt thành đúng nếu những thành phần được chỉ định trong yêu cầu được liên kết theo mối quan hệ được chỉ định trong yêu cầu. BẮT BUỘC |
maxAge |
string |
Từ thời gian phân phát, khoảng thời gian dài hơn mà phản hồi đó được coi là hợp lệ nếu không cập nhật thêm. BẮT BUỘC Thời lượng tính bằng giây có tối đa 9 chữ số phân số, kết thúc bởi "s ". Ví dụ: "3.5s" . |
debugString |
string |
Thông báo mà con người có thể đọc được, có chứa thông tin nhằm giúp người dùng cuối hiểu, tái tạo và gỡ lỗi kết quả. Thông báo này sẽ bằng tiếng Anh và hiện tại chúng tôi không có kế hoạch cung cấp bản dịch. Xin lưu ý rằng chúng tôi không đảm bảo về nội dung hoặc định dạng của chuỗi này. Bất kỳ khía cạnh nào của nội dung có thể thay đổi mà không cần thông báo. Bạn không nên tìm cách phân tích cú pháp dữ liệu này theo phương thức lập trình. Nếu bạn thấy cần phải làm việc này vì thông tin bạn cần không được API hiển thị, vui lòng liên hệ trước với chúng tôi. |
Hãy dùng thử!
Hãy sử dụng APIs Explorer (Trình khám phá API) để gọi phương thức này trên dữ liệu trực tiếp và xem phản hồi.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-06-26 UTC.
[[["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: 2024-06-26 UTC."],[[["\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."]]