Safe Browsing API
GET
safebrowsing.encodedFullHashes.get
{{baseUrl}}/v4/encodedFullHashes/:encodedRequest
QUERY PARAMS
encodedRequest
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
require "http/client"
url = "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v4/encodedFullHashes/:encodedRequest HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/encodedFullHashes/:encodedRequest',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/encodedFullHashes/:encodedRequest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest');
echo $response->getBody();
setUrl('{{baseUrl}}/v4/encodedFullHashes/:encodedRequest');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v4/encodedFullHashes/:encodedRequest');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/encodedFullHashes/:encodedRequest' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v4/encodedFullHashes/:encodedRequest")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v4/encodedFullHashes/:encodedRequest') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v4/encodedFullHashes/:encodedRequest
http GET {{baseUrl}}/v4/encodedFullHashes/:encodedRequest
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v4/encodedFullHashes/:encodedRequest
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/encodedFullHashes/:encodedRequest")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
safebrowsing.encodedUpdates.get
{{baseUrl}}/v4/encodedUpdates/:encodedRequest
QUERY PARAMS
encodedRequest
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/encodedUpdates/:encodedRequest");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
require "http/client"
url = "{{baseUrl}}/v4/encodedUpdates/:encodedRequest"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v4/encodedUpdates/:encodedRequest"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/encodedUpdates/:encodedRequest");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/encodedUpdates/:encodedRequest"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v4/encodedUpdates/:encodedRequest HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/encodedUpdates/:encodedRequest"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v4/encodedUpdates/:encodedRequest');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedUpdates/:encodedRequest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/encodedUpdates/:encodedRequest';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/encodedUpdates/:encodedRequest',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/encodedUpdates/:encodedRequest',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedUpdates/:encodedRequest'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v4/encodedUpdates/:encodedRequest');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v4/encodedUpdates/:encodedRequest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/encodedUpdates/:encodedRequest';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/encodedUpdates/:encodedRequest"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/encodedUpdates/:encodedRequest" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/encodedUpdates/:encodedRequest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v4/encodedUpdates/:encodedRequest');
echo $response->getBody();
setUrl('{{baseUrl}}/v4/encodedUpdates/:encodedRequest');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v4/encodedUpdates/:encodedRequest');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/encodedUpdates/:encodedRequest' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/encodedUpdates/:encodedRequest' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v4/encodedUpdates/:encodedRequest")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/encodedUpdates/:encodedRequest"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/encodedUpdates/:encodedRequest"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/encodedUpdates/:encodedRequest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v4/encodedUpdates/:encodedRequest') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/encodedUpdates/:encodedRequest";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v4/encodedUpdates/:encodedRequest
http GET {{baseUrl}}/v4/encodedUpdates/:encodedRequest
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v4/encodedUpdates/:encodedRequest
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/encodedUpdates/:encodedRequest")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
safebrowsing.fullHashes.find
{{baseUrl}}/v4/fullHashes:find
BODY json
{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/fullHashes:find");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/fullHashes:find" {:content-type :json
:form-params {:apiClient {:clientId ""
:clientVersion ""}
:client {}
:clientStates []
:threatInfo {:platformTypes []
:threatEntries [{:digest ""
:hash ""
:url ""}]
:threatEntryTypes []
:threatTypes []}}})
require "http/client"
url = "{{baseUrl}}/v4/fullHashes:find"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/fullHashes:find"),
Content = new StringContent("{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/fullHashes:find");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/fullHashes:find"
payload := strings.NewReader("{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/fullHashes:find HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 310
{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/fullHashes:find")
.setHeader("content-type", "application/json")
.setBody("{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/fullHashes:find"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/fullHashes:find")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/fullHashes:find")
.header("content-type", "application/json")
.body("{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
.asString();
const data = JSON.stringify({
apiClient: {
clientId: '',
clientVersion: ''
},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [
{
digest: '',
hash: '',
url: ''
}
],
threatEntryTypes: [],
threatTypes: []
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/fullHashes:find');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/fullHashes:find',
headers: {'content-type': 'application/json'},
data: {
apiClient: {clientId: '', clientVersion: ''},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/fullHashes:find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"apiClient":{"clientId":"","clientVersion":""},"client":{},"clientStates":[],"threatInfo":{"platformTypes":[],"threatEntries":[{"digest":"","hash":"","url":""}],"threatEntryTypes":[],"threatTypes":[]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/fullHashes:find',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "apiClient": {\n "clientId": "",\n "clientVersion": ""\n },\n "client": {},\n "clientStates": [],\n "threatInfo": {\n "platformTypes": [],\n "threatEntries": [\n {\n "digest": "",\n "hash": "",\n "url": ""\n }\n ],\n "threatEntryTypes": [],\n "threatTypes": []\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/fullHashes:find")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/fullHashes:find',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
apiClient: {clientId: '', clientVersion: ''},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/fullHashes:find',
headers: {'content-type': 'application/json'},
body: {
apiClient: {clientId: '', clientVersion: ''},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/fullHashes:find');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
apiClient: {
clientId: '',
clientVersion: ''
},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [
{
digest: '',
hash: '',
url: ''
}
],
threatEntryTypes: [],
threatTypes: []
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/fullHashes:find',
headers: {'content-type': 'application/json'},
data: {
apiClient: {clientId: '', clientVersion: ''},
client: {},
clientStates: [],
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/fullHashes:find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"apiClient":{"clientId":"","clientVersion":""},"client":{},"clientStates":[],"threatInfo":{"platformTypes":[],"threatEntries":[{"digest":"","hash":"","url":""}],"threatEntryTypes":[],"threatTypes":[]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"apiClient": @{ @"clientId": @"", @"clientVersion": @"" },
@"client": @{ },
@"clientStates": @[ ],
@"threatInfo": @{ @"platformTypes": @[ ], @"threatEntries": @[ @{ @"digest": @"", @"hash": @"", @"url": @"" } ], @"threatEntryTypes": @[ ], @"threatTypes": @[ ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/fullHashes:find"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/fullHashes:find" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/fullHashes:find",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiClient' => [
'clientId' => '',
'clientVersion' => ''
],
'client' => [
],
'clientStates' => [
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/fullHashes:find', [
'body' => '{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/fullHashes:find');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'apiClient' => [
'clientId' => '',
'clientVersion' => ''
],
'client' => [
],
'clientStates' => [
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'apiClient' => [
'clientId' => '',
'clientVersion' => ''
],
'client' => [
],
'clientStates' => [
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v4/fullHashes:find');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/fullHashes:find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/fullHashes:find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/fullHashes:find", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/fullHashes:find"
payload = {
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/fullHashes:find"
payload <- "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/fullHashes:find")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/fullHashes:find') do |req|
req.body = "{\n \"apiClient\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"client\": {},\n \"clientStates\": [],\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/fullHashes:find";
let payload = json!({
"apiClient": json!({
"clientId": "",
"clientVersion": ""
}),
"client": json!({}),
"clientStates": (),
"threatInfo": json!({
"platformTypes": (),
"threatEntries": (
json!({
"digest": "",
"hash": "",
"url": ""
})
),
"threatEntryTypes": (),
"threatTypes": ()
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/fullHashes:find \
--header 'content-type: application/json' \
--data '{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
echo '{
"apiClient": {
"clientId": "",
"clientVersion": ""
},
"client": {},
"clientStates": [],
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}' | \
http POST {{baseUrl}}/v4/fullHashes:find \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "apiClient": {\n "clientId": "",\n "clientVersion": ""\n },\n "client": {},\n "clientStates": [],\n "threatInfo": {\n "platformTypes": [],\n "threatEntries": [\n {\n "digest": "",\n "hash": "",\n "url": ""\n }\n ],\n "threatEntryTypes": [],\n "threatTypes": []\n }\n}' \
--output-document \
- {{baseUrl}}/v4/fullHashes:find
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"apiClient": [
"clientId": "",
"clientVersion": ""
],
"client": [],
"clientStates": [],
"threatInfo": [
"platformTypes": [],
"threatEntries": [
[
"digest": "",
"hash": "",
"url": ""
]
],
"threatEntryTypes": [],
"threatTypes": []
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/fullHashes:find")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
safebrowsing.threatHits.create
{{baseUrl}}/v4/threatHits
BODY json
{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/threatHits");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/threatHits" {:content-type :json
:form-params {:clientInfo {:clientId ""
:clientVersion ""}
:entry {:digest ""
:hash ""
:url ""}
:platformType ""
:resources [{:referrer ""
:remoteIp ""
:type ""
:url ""}]
:threatType ""
:userInfo {:regionCode ""
:userId ""}}})
require "http/client"
url = "{{baseUrl}}/v4/threatHits"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/threatHits"),
Content = new StringContent("{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/threatHits");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/threatHits"
payload := strings.NewReader("{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/threatHits HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 349
{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/threatHits")
.setHeader("content-type", "application/json")
.setBody("{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/threatHits"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/threatHits")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/threatHits")
.header("content-type", "application/json")
.body("{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
clientInfo: {
clientId: '',
clientVersion: ''
},
entry: {
digest: '',
hash: '',
url: ''
},
platformType: '',
resources: [
{
referrer: '',
remoteIp: '',
type: '',
url: ''
}
],
threatType: '',
userInfo: {
regionCode: '',
userId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/threatHits');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatHits',
headers: {'content-type': 'application/json'},
data: {
clientInfo: {clientId: '', clientVersion: ''},
entry: {digest: '', hash: '', url: ''},
platformType: '',
resources: [{referrer: '', remoteIp: '', type: '', url: ''}],
threatType: '',
userInfo: {regionCode: '', userId: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/threatHits';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientInfo":{"clientId":"","clientVersion":""},"entry":{"digest":"","hash":"","url":""},"platformType":"","resources":[{"referrer":"","remoteIp":"","type":"","url":""}],"threatType":"","userInfo":{"regionCode":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/threatHits',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clientInfo": {\n "clientId": "",\n "clientVersion": ""\n },\n "entry": {\n "digest": "",\n "hash": "",\n "url": ""\n },\n "platformType": "",\n "resources": [\n {\n "referrer": "",\n "remoteIp": "",\n "type": "",\n "url": ""\n }\n ],\n "threatType": "",\n "userInfo": {\n "regionCode": "",\n "userId": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/threatHits")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/threatHits',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
clientInfo: {clientId: '', clientVersion: ''},
entry: {digest: '', hash: '', url: ''},
platformType: '',
resources: [{referrer: '', remoteIp: '', type: '', url: ''}],
threatType: '',
userInfo: {regionCode: '', userId: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatHits',
headers: {'content-type': 'application/json'},
body: {
clientInfo: {clientId: '', clientVersion: ''},
entry: {digest: '', hash: '', url: ''},
platformType: '',
resources: [{referrer: '', remoteIp: '', type: '', url: ''}],
threatType: '',
userInfo: {regionCode: '', userId: ''}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/threatHits');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clientInfo: {
clientId: '',
clientVersion: ''
},
entry: {
digest: '',
hash: '',
url: ''
},
platformType: '',
resources: [
{
referrer: '',
remoteIp: '',
type: '',
url: ''
}
],
threatType: '',
userInfo: {
regionCode: '',
userId: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatHits',
headers: {'content-type': 'application/json'},
data: {
clientInfo: {clientId: '', clientVersion: ''},
entry: {digest: '', hash: '', url: ''},
platformType: '',
resources: [{referrer: '', remoteIp: '', type: '', url: ''}],
threatType: '',
userInfo: {regionCode: '', userId: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/threatHits';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientInfo":{"clientId":"","clientVersion":""},"entry":{"digest":"","hash":"","url":""},"platformType":"","resources":[{"referrer":"","remoteIp":"","type":"","url":""}],"threatType":"","userInfo":{"regionCode":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clientInfo": @{ @"clientId": @"", @"clientVersion": @"" },
@"entry": @{ @"digest": @"", @"hash": @"", @"url": @"" },
@"platformType": @"",
@"resources": @[ @{ @"referrer": @"", @"remoteIp": @"", @"type": @"", @"url": @"" } ],
@"threatType": @"",
@"userInfo": @{ @"regionCode": @"", @"userId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/threatHits"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/threatHits" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/threatHits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'clientInfo' => [
'clientId' => '',
'clientVersion' => ''
],
'entry' => [
'digest' => '',
'hash' => '',
'url' => ''
],
'platformType' => '',
'resources' => [
[
'referrer' => '',
'remoteIp' => '',
'type' => '',
'url' => ''
]
],
'threatType' => '',
'userInfo' => [
'regionCode' => '',
'userId' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/threatHits', [
'body' => '{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/threatHits');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clientInfo' => [
'clientId' => '',
'clientVersion' => ''
],
'entry' => [
'digest' => '',
'hash' => '',
'url' => ''
],
'platformType' => '',
'resources' => [
[
'referrer' => '',
'remoteIp' => '',
'type' => '',
'url' => ''
]
],
'threatType' => '',
'userInfo' => [
'regionCode' => '',
'userId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clientInfo' => [
'clientId' => '',
'clientVersion' => ''
],
'entry' => [
'digest' => '',
'hash' => '',
'url' => ''
],
'platformType' => '',
'resources' => [
[
'referrer' => '',
'remoteIp' => '',
'type' => '',
'url' => ''
]
],
'threatType' => '',
'userInfo' => [
'regionCode' => '',
'userId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v4/threatHits');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/threatHits' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/threatHits' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/threatHits", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/threatHits"
payload = {
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/threatHits"
payload <- "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/threatHits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/threatHits') do |req|
req.body = "{\n \"clientInfo\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"entry\": {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n },\n \"platformType\": \"\",\n \"resources\": [\n {\n \"referrer\": \"\",\n \"remoteIp\": \"\",\n \"type\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatType\": \"\",\n \"userInfo\": {\n \"regionCode\": \"\",\n \"userId\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/threatHits";
let payload = json!({
"clientInfo": json!({
"clientId": "",
"clientVersion": ""
}),
"entry": json!({
"digest": "",
"hash": "",
"url": ""
}),
"platformType": "",
"resources": (
json!({
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
})
),
"threatType": "",
"userInfo": json!({
"regionCode": "",
"userId": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/threatHits \
--header 'content-type: application/json' \
--data '{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}'
echo '{
"clientInfo": {
"clientId": "",
"clientVersion": ""
},
"entry": {
"digest": "",
"hash": "",
"url": ""
},
"platformType": "",
"resources": [
{
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
}
],
"threatType": "",
"userInfo": {
"regionCode": "",
"userId": ""
}
}' | \
http POST {{baseUrl}}/v4/threatHits \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "clientInfo": {\n "clientId": "",\n "clientVersion": ""\n },\n "entry": {\n "digest": "",\n "hash": "",\n "url": ""\n },\n "platformType": "",\n "resources": [\n {\n "referrer": "",\n "remoteIp": "",\n "type": "",\n "url": ""\n }\n ],\n "threatType": "",\n "userInfo": {\n "regionCode": "",\n "userId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v4/threatHits
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clientInfo": [
"clientId": "",
"clientVersion": ""
],
"entry": [
"digest": "",
"hash": "",
"url": ""
],
"platformType": "",
"resources": [
[
"referrer": "",
"remoteIp": "",
"type": "",
"url": ""
]
],
"threatType": "",
"userInfo": [
"regionCode": "",
"userId": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/threatHits")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
safebrowsing.threatLists.list
{{baseUrl}}/v4/threatLists
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/threatLists");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v4/threatLists")
require "http/client"
url = "{{baseUrl}}/v4/threatLists"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v4/threatLists"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/threatLists");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/threatLists"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v4/threatLists HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v4/threatLists")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/threatLists"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/threatLists")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v4/threatLists")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v4/threatLists');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v4/threatLists'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/threatLists';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/threatLists',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v4/threatLists")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/threatLists',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v4/threatLists'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v4/threatLists');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v4/threatLists'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/threatLists';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/threatLists"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/threatLists" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/threatLists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v4/threatLists');
echo $response->getBody();
setUrl('{{baseUrl}}/v4/threatLists');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v4/threatLists');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/threatLists' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/threatLists' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v4/threatLists")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/threatLists"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/threatLists"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/threatLists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v4/threatLists') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/threatLists";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v4/threatLists
http GET {{baseUrl}}/v4/threatLists
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v4/threatLists
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/threatLists")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
safebrowsing.threatListUpdates.fetch
{{baseUrl}}/v4/threatListUpdates:fetch
BODY json
{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/threatListUpdates:fetch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/threatListUpdates:fetch" {:content-type :json
:form-params {:client {:clientId ""
:clientVersion ""}
:listUpdateRequests [{:constraints {:deviceLocation ""
:language ""
:maxDatabaseEntries 0
:maxUpdateEntries 0
:region ""
:supportedCompressions []}
:platformType ""
:state ""
:threatEntryType ""
:threatType ""}]}})
require "http/client"
url = "{{baseUrl}}/v4/threatListUpdates:fetch"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/threatListUpdates:fetch"),
Content = new StringContent("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/threatListUpdates:fetch");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/threatListUpdates:fetch"
payload := strings.NewReader("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/threatListUpdates:fetch HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 413
{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/threatListUpdates:fetch")
.setHeader("content-type", "application/json")
.setBody("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/threatListUpdates:fetch"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/threatListUpdates:fetch")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/threatListUpdates:fetch")
.header("content-type", "application/json")
.body("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
client: {
clientId: '',
clientVersion: ''
},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/threatListUpdates:fetch');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatListUpdates:fetch',
headers: {'content-type': 'application/json'},
data: {
client: {clientId: '', clientVersion: ''},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/threatListUpdates:fetch';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client":{"clientId":"","clientVersion":""},"listUpdateRequests":[{"constraints":{"deviceLocation":"","language":"","maxDatabaseEntries":0,"maxUpdateEntries":0,"region":"","supportedCompressions":[]},"platformType":"","state":"","threatEntryType":"","threatType":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/threatListUpdates:fetch',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client": {\n "clientId": "",\n "clientVersion": ""\n },\n "listUpdateRequests": [\n {\n "constraints": {\n "deviceLocation": "",\n "language": "",\n "maxDatabaseEntries": 0,\n "maxUpdateEntries": 0,\n "region": "",\n "supportedCompressions": []\n },\n "platformType": "",\n "state": "",\n "threatEntryType": "",\n "threatType": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/threatListUpdates:fetch")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/threatListUpdates:fetch',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
client: {clientId: '', clientVersion: ''},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatListUpdates:fetch',
headers: {'content-type': 'application/json'},
body: {
client: {clientId: '', clientVersion: ''},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/threatListUpdates:fetch');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client: {
clientId: '',
clientVersion: ''
},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatListUpdates:fetch',
headers: {'content-type': 'application/json'},
data: {
client: {clientId: '', clientVersion: ''},
listUpdateRequests: [
{
constraints: {
deviceLocation: '',
language: '',
maxDatabaseEntries: 0,
maxUpdateEntries: 0,
region: '',
supportedCompressions: []
},
platformType: '',
state: '',
threatEntryType: '',
threatType: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/threatListUpdates:fetch';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client":{"clientId":"","clientVersion":""},"listUpdateRequests":[{"constraints":{"deviceLocation":"","language":"","maxDatabaseEntries":0,"maxUpdateEntries":0,"region":"","supportedCompressions":[]},"platformType":"","state":"","threatEntryType":"","threatType":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"client": @{ @"clientId": @"", @"clientVersion": @"" },
@"listUpdateRequests": @[ @{ @"constraints": @{ @"deviceLocation": @"", @"language": @"", @"maxDatabaseEntries": @0, @"maxUpdateEntries": @0, @"region": @"", @"supportedCompressions": @[ ] }, @"platformType": @"", @"state": @"", @"threatEntryType": @"", @"threatType": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/threatListUpdates:fetch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/threatListUpdates:fetch" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/threatListUpdates:fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'listUpdateRequests' => [
[
'constraints' => [
'deviceLocation' => '',
'language' => '',
'maxDatabaseEntries' => 0,
'maxUpdateEntries' => 0,
'region' => '',
'supportedCompressions' => [
]
],
'platformType' => '',
'state' => '',
'threatEntryType' => '',
'threatType' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/threatListUpdates:fetch', [
'body' => '{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/threatListUpdates:fetch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'listUpdateRequests' => [
[
'constraints' => [
'deviceLocation' => '',
'language' => '',
'maxDatabaseEntries' => 0,
'maxUpdateEntries' => 0,
'region' => '',
'supportedCompressions' => [
]
],
'platformType' => '',
'state' => '',
'threatEntryType' => '',
'threatType' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'listUpdateRequests' => [
[
'constraints' => [
'deviceLocation' => '',
'language' => '',
'maxDatabaseEntries' => 0,
'maxUpdateEntries' => 0,
'region' => '',
'supportedCompressions' => [
]
],
'platformType' => '',
'state' => '',
'threatEntryType' => '',
'threatType' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v4/threatListUpdates:fetch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/threatListUpdates:fetch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/threatListUpdates:fetch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/threatListUpdates:fetch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/threatListUpdates:fetch"
payload = {
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/threatListUpdates:fetch"
payload <- "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/threatListUpdates:fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/threatListUpdates:fetch') do |req|
req.body = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"listUpdateRequests\": [\n {\n \"constraints\": {\n \"deviceLocation\": \"\",\n \"language\": \"\",\n \"maxDatabaseEntries\": 0,\n \"maxUpdateEntries\": 0,\n \"region\": \"\",\n \"supportedCompressions\": []\n },\n \"platformType\": \"\",\n \"state\": \"\",\n \"threatEntryType\": \"\",\n \"threatType\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/threatListUpdates:fetch";
let payload = json!({
"client": json!({
"clientId": "",
"clientVersion": ""
}),
"listUpdateRequests": (
json!({
"constraints": json!({
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": ()
}),
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/threatListUpdates:fetch \
--header 'content-type: application/json' \
--data '{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}'
echo '{
"client": {
"clientId": "",
"clientVersion": ""
},
"listUpdateRequests": [
{
"constraints": {
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
},
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
}
]
}' | \
http POST {{baseUrl}}/v4/threatListUpdates:fetch \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client": {\n "clientId": "",\n "clientVersion": ""\n },\n "listUpdateRequests": [\n {\n "constraints": {\n "deviceLocation": "",\n "language": "",\n "maxDatabaseEntries": 0,\n "maxUpdateEntries": 0,\n "region": "",\n "supportedCompressions": []\n },\n "platformType": "",\n "state": "",\n "threatEntryType": "",\n "threatType": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/v4/threatListUpdates:fetch
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client": [
"clientId": "",
"clientVersion": ""
],
"listUpdateRequests": [
[
"constraints": [
"deviceLocation": "",
"language": "",
"maxDatabaseEntries": 0,
"maxUpdateEntries": 0,
"region": "",
"supportedCompressions": []
],
"platformType": "",
"state": "",
"threatEntryType": "",
"threatType": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/threatListUpdates:fetch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
safebrowsing.threatMatches.find
{{baseUrl}}/v4/threatMatches:find
BODY json
{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v4/threatMatches:find");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v4/threatMatches:find" {:content-type :json
:form-params {:client {:clientId ""
:clientVersion ""}
:threatInfo {:platformTypes []
:threatEntries [{:digest ""
:hash ""
:url ""}]
:threatEntryTypes []
:threatTypes []}}})
require "http/client"
url = "{{baseUrl}}/v4/threatMatches:find"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v4/threatMatches:find"),
Content = new StringContent("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v4/threatMatches:find");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v4/threatMatches:find"
payload := strings.NewReader("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v4/threatMatches:find HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 269
{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v4/threatMatches:find")
.setHeader("content-type", "application/json")
.setBody("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v4/threatMatches:find"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v4/threatMatches:find")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v4/threatMatches:find")
.header("content-type", "application/json")
.body("{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
.asString();
const data = JSON.stringify({
client: {
clientId: '',
clientVersion: ''
},
threatInfo: {
platformTypes: [],
threatEntries: [
{
digest: '',
hash: '',
url: ''
}
],
threatEntryTypes: [],
threatTypes: []
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v4/threatMatches:find');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatMatches:find',
headers: {'content-type': 'application/json'},
data: {
client: {clientId: '', clientVersion: ''},
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v4/threatMatches:find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client":{"clientId":"","clientVersion":""},"threatInfo":{"platformTypes":[],"threatEntries":[{"digest":"","hash":"","url":""}],"threatEntryTypes":[],"threatTypes":[]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v4/threatMatches:find',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client": {\n "clientId": "",\n "clientVersion": ""\n },\n "threatInfo": {\n "platformTypes": [],\n "threatEntries": [\n {\n "digest": "",\n "hash": "",\n "url": ""\n }\n ],\n "threatEntryTypes": [],\n "threatTypes": []\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v4/threatMatches:find")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v4/threatMatches:find',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
client: {clientId: '', clientVersion: ''},
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatMatches:find',
headers: {'content-type': 'application/json'},
body: {
client: {clientId: '', clientVersion: ''},
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v4/threatMatches:find');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client: {
clientId: '',
clientVersion: ''
},
threatInfo: {
platformTypes: [],
threatEntries: [
{
digest: '',
hash: '',
url: ''
}
],
threatEntryTypes: [],
threatTypes: []
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v4/threatMatches:find',
headers: {'content-type': 'application/json'},
data: {
client: {clientId: '', clientVersion: ''},
threatInfo: {
platformTypes: [],
threatEntries: [{digest: '', hash: '', url: ''}],
threatEntryTypes: [],
threatTypes: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v4/threatMatches:find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client":{"clientId":"","clientVersion":""},"threatInfo":{"platformTypes":[],"threatEntries":[{"digest":"","hash":"","url":""}],"threatEntryTypes":[],"threatTypes":[]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"client": @{ @"clientId": @"", @"clientVersion": @"" },
@"threatInfo": @{ @"platformTypes": @[ ], @"threatEntries": @[ @{ @"digest": @"", @"hash": @"", @"url": @"" } ], @"threatEntryTypes": @[ ], @"threatTypes": @[ ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v4/threatMatches:find"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v4/threatMatches:find" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v4/threatMatches:find",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v4/threatMatches:find', [
'body' => '{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v4/threatMatches:find');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client' => [
'clientId' => '',
'clientVersion' => ''
],
'threatInfo' => [
'platformTypes' => [
],
'threatEntries' => [
[
'digest' => '',
'hash' => '',
'url' => ''
]
],
'threatEntryTypes' => [
],
'threatTypes' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v4/threatMatches:find');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v4/threatMatches:find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v4/threatMatches:find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v4/threatMatches:find", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v4/threatMatches:find"
payload = {
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v4/threatMatches:find"
payload <- "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v4/threatMatches:find")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v4/threatMatches:find') do |req|
req.body = "{\n \"client\": {\n \"clientId\": \"\",\n \"clientVersion\": \"\"\n },\n \"threatInfo\": {\n \"platformTypes\": [],\n \"threatEntries\": [\n {\n \"digest\": \"\",\n \"hash\": \"\",\n \"url\": \"\"\n }\n ],\n \"threatEntryTypes\": [],\n \"threatTypes\": []\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v4/threatMatches:find";
let payload = json!({
"client": json!({
"clientId": "",
"clientVersion": ""
}),
"threatInfo": json!({
"platformTypes": (),
"threatEntries": (
json!({
"digest": "",
"hash": "",
"url": ""
})
),
"threatEntryTypes": (),
"threatTypes": ()
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v4/threatMatches:find \
--header 'content-type: application/json' \
--data '{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}'
echo '{
"client": {
"clientId": "",
"clientVersion": ""
},
"threatInfo": {
"platformTypes": [],
"threatEntries": [
{
"digest": "",
"hash": "",
"url": ""
}
],
"threatEntryTypes": [],
"threatTypes": []
}
}' | \
http POST {{baseUrl}}/v4/threatMatches:find \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client": {\n "clientId": "",\n "clientVersion": ""\n },\n "threatInfo": {\n "platformTypes": [],\n "threatEntries": [\n {\n "digest": "",\n "hash": "",\n "url": ""\n }\n ],\n "threatEntryTypes": [],\n "threatTypes": []\n }\n}' \
--output-document \
- {{baseUrl}}/v4/threatMatches:find
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client": [
"clientId": "",
"clientVersion": ""
],
"threatInfo": [
"platformTypes": [],
"threatEntries": [
[
"digest": "",
"hash": "",
"url": ""
]
],
"threatEntryTypes": [],
"threatTypes": []
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v4/threatMatches:find")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()