Using the Submission v2 API

Overview

The Submission API lets you submit URLs that you suspect are unsafe to Safe Browsing for analysis, and asynchronously check the results of these submissions. Any URLs that are confirmed to match the Safe Browsing Policies will be added to the Safe Browsing service.

Before you begin

Please contact Sales or your Customer Engineer in order to obtain access to this feature.

Submitting URLs

To submit a URL, send an HTTP POST request to the projects.uris.submit method.

  • The Submission API supports one URL per request. To check multiple URLs, you need to send a separate request for each URL.
  • The URL must be valid (see RFC 2396) but it doesn't need to be canonicalized.
  • The HTTP POST response returns a long-running operation. For more information on how to retrieve the submission result, please refer to Long-running operations.

Example

HTTP method and URL:

POST "https://webrisk.googleapis.com/v1/projects/project-id/uris:submit"

Request JSON body:

{
  "submission": {
    "uri": "https://www.phishingsite.com/",
  },
}

To send your request, choose one of these options:

curl

Save the request body in a file called request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://webrisk.googleapis.com/v1/projects/project-id/uris:submit"

PowerShell

Save the request body in a file called request.json, and execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri ""https://webrisk.googleapis.com/v1/projects/project-id/uris:submit"" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/project-id/operations/operation-id",
}