I'm trying to send a hash as a payload for the Safebrowsing API to detect if the file is suspicious/malicious, but i'm having trouble sending the correct payload apparently.
My payload:
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 states the I need to use the ThreatEntry
object (see screenshot below)
And this is how the threatEntry
object should look like https://developers.google.com/safe-browsing/v4/reference/rest/v4/ThreatEntry . It says I only need to use one of the options, so I went for hash
as seen above in my payload, but this error is returned to me.
{
"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."
}
]
}
]
}
}
What am I doing wrong?