Method: hashLists.batchGet
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.
Nhận nhiều danh sách băm cùng một lúc.
Rất thường xuyên, ứng dụng cần nhận nhiều danh sách băm. Bạn nên sử dụng phương thức này thay vì sử dụng phương thức Get thông thường nhiều lần.
Đây là phương thức Lấy hàng loạt chuẩn do https://google.aip.dev/231 xác định và phương thức HTTP cũng là GET.
Yêu cầu HTTP
GET https://safebrowsing.googleapis.com/v5alpha1/hashLists:batchGet
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số truy vấn
Thông số |
names[] |
string
Bắt buộc. Tên của các danh sách băm cụ thể. Danh sách này CÓ THỂ là danh sách mối đe doạ hoặc có thể là Bộ nhớ đệm toàn cầu. Tên KHÔNG ĐƯỢC chứa tên trùng lặp; nếu có, ứng dụng khách sẽ gặp lỗi.
|
version[] |
string (bytes format)
Các phiên bản của danh sách băm mà ứng dụng khách đã có. Nếu đây là lần đầu tiên ứng dụng tìm nạp danh sách băm, thì trường này phải để trống. Nếu không, ứng dụng khách phải cung cấp các phiên bản đã nhận được trước đó từ máy chủ. Ứng dụng KHÔNG ĐƯỢC thao túng các byte đó. Ứng dụng không cần gửi các phiên bản theo thứ tự giống với tên danh sách tương ứng. Ứng dụng có thể gửi ít hoặc nhiều phiên bản trong một yêu cầu so với số lượng tên. Tuy nhiên, ứng dụng KHÔNG ĐƯỢC gửi nhiều phiên bản tương ứng với cùng một tên; nếu gửi, ứng dụng sẽ gặp lỗi. Lưu ý về quá khứ: trong API phiên bản 4, thuộc tính này được gọi là states ; hiện được đổi tên thành version để rõ ràng hơn. Chuỗi được mã hoá base64.
|
sizeConstraints |
object (SizeConstraints )
Giới hạn về kích thước trên mỗi danh sách. Nếu bạn bỏ qua, thì sẽ không có quy tắc ràng buộc nào. Xin lưu ý rằng kích thước ở đây là theo danh sách, chứ không phải tổng hợp trên tất cả danh sách.
|
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
Phản hồi chứa nhiều danh sách băm.
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:
Biểu diễn dưới dạng JSON |
{
"hashLists": [
{
object (HashList )
}
]
} |
Trường |
hashLists[] |
object (HashList )
Các danh sách băm theo thứ tự được đưa ra trong yêu cầu.
|
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: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eBatch retrieve multiple hash lists efficiently, rather than using individual Get requests.\u003c/p\u003e\n"],["\u003cp\u003eSpecify desired hash lists by name, versions (if previously fetched), desired hash prefix length, and optionally, size constraints.\u003c/p\u003e\n"],["\u003cp\u003eReceive a response containing the requested hash lists in the specified order.\u003c/p\u003e\n"],["\u003cp\u003eThis method adheres to the standard batch Get method as defined by Google AIP and uses the GET HTTP method.\u003c/p\u003e\n"],["\u003cp\u003eRequest body should be empty for this operation.\u003c/p\u003e\n"]]],["This document details the `batchGet` method for retrieving multiple hash lists via a `GET` HTTP request to `safebrowsing.googleapis.com/v5alpha1/hashLists:batchGet`. Required parameters include `names[]` for specifying hash lists and `version[]` for indicating existing versions. `desiredHashLength` defines the desired hash prefix length, and `sizeConstraints` limits list sizes. The request body is empty, and the response contains an array `hashLists[]`, ordered as requested.\n"],null,["# Method: hashLists.batchGet\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.BatchGetHashListsResponse.SCHEMA_REPRESENTATION)\n\nGet multiple hash lists at once.\n\nIt is very common for a client to need to get multiple hash lists. Using this method is preferred over using the regular Get method multiple times.\n\nThis is a standard batch Get method as defined by \u003chttps://google.aip.dev/231\u003e and the HTTP method is also GET.\n\n### HTTP request\n\n`GET https://safebrowsing.googleapis.com/v5alpha1/hashLists:batchGet`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `names[]` | `string` Required. The names of the particular hash lists. The list MAY be a threat list, or it may be the Global Cache. The names MUST NOT contain duplicates; if they did, the client will get an error. |\n| `version[]` | `string (`[bytes](https://developers.google.com/discovery/v1/type-format)` format)` The versions of the hash list that the client already has. If this is the first time the client is fetching the hash lists, the field should be left empty. Otherwise, the client should supply the versions previously received from the server. The client MUST NOT manipulate those bytes. The client need not send the versions in the same order as the corresponding list names. The client may send fewer or more versions in a request than there are names. However the client MUST NOT send multiple versions that correspond to the same name; if it did, the client will get an error. Historical note: in V4 of the API, this was called `states`; it is now renamed to `version` for clarity. A base64-encoded string. |\n| `sizeConstraints` | `object (`[SizeConstraints](/safe-browsing/reference/rest/v5alpha1/SizeConstraints)`)` The size constraints on each list. If omitted, there are no constraints. Note that the sizes here are per-list, not aggregated across all lists. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nThe response containing multiple hash lists.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------|\n| ``` { \"hashLists\": [ { object (/safe-browsing/reference/rest/v5alpha1/hashList#HashList) } ] } ``` |\n\n| Fields ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `hashLists[]` | `object (`[HashList](/safe-browsing/reference/rest/v5alpha1/hashList#HashList)`)` The hash lists in the same order given in the request. |"]]