我正在尝试发送一个哈希作为 Safebrowsing API 的有效负载,以检测文件是否可疑/恶意,但我显然无法发送正确的有效负载。
我的有效载荷:
curl --location --request POST 'https://safebrowsing.googleapis.com/v4/threatMatches:find?key=myKey' \
--header 'Content-Type: application/json' \
--data-raw '{
"hash": "YzIyZDM4NDA="
}'
https://developers.google.com/safe-browsing/v4/lookup-api声明我需要使用该ThreatEntry
对象(见下面的截图)
这就是threatEntry
对象应该看起来像https://developers.google.com/safe-browsing/v4/reference/rest/v4/ThreatEntry的样子。它说我只需要使用其中一个选项,所以我hash
在我的有效负载中如上所示,但这个错误被返回给我。
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"hash\": Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"hash\": Cannot find field."
}
]
}
]
}
}
我究竟做错了什么?