function checkLink(){
//Google API Key
var apiKey = ""; //My actual key is in here
//URL for safebrowsing
var googleURL = "https://safebrowsing.googleapis.com/v4/threatMatches:find?key=";
//Combine the url and the key
googleURL = googleURL + apiKey;
//print this to the console
console.log(googleURL);
//attempt to contact the google server
// var headers = {
// 'content-type': 'applicataion/json'
// };
var payload =
{
"client": {
"clientId": "infsci1073amh217",
"clientVersion": "1.5.2"
},
"threatInfo": {
"threatTypes": ["MALWARE", "SOCIAL_ENGINEERING"],
"platformTypes": ["WINDOWS"],
"threatEntryTypes": ["URL"],
"threatEntries": [
{"url": "http://www.pitt.edu/"},
{"url": "http://www.exchange.pitt.edu/"}
]
}
};
$.ajax({
type: "POST",
url: googleURL,
contentType: "applicaiton/json; charset=utf-8",
dataType: "json",
data: payload,
success:function (data) {
console.log(data);
},
error:function(status){
console.log(status);
}
});
}
In my code, I found one issue where I put applicaiton/json instead of application/json, but this did not fix the issue. Still trying to get any ideas on this.
Thanks!
--
You received this message because you are subscribed to the Google Groups "Google Safe Browsing API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-safe-browsi...@googlegroups.com.
To post to this group, send email to google-safe-...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-safe-browsing-api.
For more options, visit https://groups.google.com/d/optout.
Hi Allen,The error message you shared suggests that jQuery is doing some unexpected formatting of the request body. You could instead try passing JSON.stringify(payload) to the ajax's data parameter? If that doesn't work, you can use the Chrome Developer Tools to inspect the body of the produced request to make sure it looks well-formed.Hopefully that helps!Alex
On Wed, Feb 8, 2017 at 7:49 AM Allen Howard <allenh...@gmail.com> wrote:
In my code, I found one issue where I put applicaiton/json instead of application/json, but this did not fix the issue. Still trying to get any ideas on this.--
Thanks!
You received this message because you are subscribed to the Google Groups "Google Safe Browsing API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-safe-browsing-api+unsub...@googlegroups.com.