I am trying to use Googles Safe Browsing Lookup API (v4, https://developers.google.com/safe-browsing/v4/lookup-api ) with a .NET application and had trouble finding example code.
I installed Google's nuget package but could find no examples on their github repo at https://github.com/google/google-api-dotnet-client
The best example I could find was at https://developers.google.com/api-client-library/dotnet/get_started but even that does not show me exactly what I am looking for. I just want to lookup what the status of a URL is. Below is the only example I found from google.
// Create the service.
var service = new DiscoveryService(new BaseClientService.Initializer
{
ApplicationName = "Discovery Sample",
ApiKey="[YOUR_API_KEY_HERE]",
});
// Run the request.
Console.WriteLine("Executing a list request...");
var result = await service.Apis.List().ExecuteAsync();
// Display the results.
if (result.Items != null)
{
foreach (DirectoryList.ItemsData api in result.Items)
{
Console.WriteLine(api.Id + " - " + api.Title);
}
}
I also tried a wrapper https://github.com/acastaner/safebrowsinglookup that looked fairly simple by using
var client = new LookupClient("key", "dotnet-client");
var response = await client.LookupAsync("http://amazon.com");
But this came back "unknown" every time. I made sure I registered a new key with google and gave it access to the Google Safe Browsing Api 4.
Any suggestions on how to use googles api to just get the response of one or many urls?
Appreciate it!