Violation Weight Map
What is the Violation Weight Map?
The risk
computation of a URL is based on the weight
of each violation. The weight
is a decimal number between 0
and 1
. A weight
of 0
completely discards the violation from the risk
calculation, and a weight of 1
gives the violation the most importance.
While AdSecure provides a default violation weight map, this endpoint allows you to set your own weights and thus customize the calculus of the risk
to your own needs.
Setting a custom Violation Weight Map
You need to be authenticated to use this method.
Method: POST
Path: /violation-weight-map
Body:
[
{ "login": "adware", "weight": 0 },
{ "login": "ssl-non-compliant", "weight": 0.9 }
]
cURL:
curl --request POST \
-H "Content-Type: application/json" \
-H 'Authorization: YOUR_API_KEY' \
-d '[{"login":"adware","weight":0}]' \
-v https://api.adsecure.com/threat-intelligence/v1/violation-weight-map
This method is an operation that updates your currently defined Violation Weight Map. Any value already present will be overwritten, and values that are absent will be inserted.
At any point, you may completely clear your user-defined Violation Weight Map by sending an empty array (
[]
) as the body instead. AdSecure will then rely on the default Violation Weight Map to compute the risk.
This method returns the standard response shape.
Fetching your Violation Weight Map
You need to be authenticated to use this method.
Method: GET
Path: /violation-weight-map
cURL:
curl --request GET \
-H 'Authorization: YOUR_API_KEY' \
-v https://api.adsecure.com/threat-intelligence/v1/violation-weight-map
This method returns the standard response shape.
Response shape
{
"violationWeightMap": [
{
"login": "adware",
"lastUpdatedAt": "2019-10-04T13:59:10Z",
"weight": 0
},
{
"login": "auto-click",
"lastUpdatedAt": "",
"weight": 0.2
}
]
}
Both methods return the same response shape. It is an alphabetically sorted list of the user-defined weights for each violations, which was merged with the default violation weights.
In this example, the weight for adware
was user defined as the time at which it was last updated is included. However, the weight for the auto-click
violation was provided by default.
Please note that the
violationWeightMap
array in the example response shape has been truncated for readability. The actual array will contain an entry for each violation defined in the default violation weight map.
Default Violation Weight Map
AdSecure defines its default violation weight map as follow:
{
"adware": 1,
"auto-download": 1,
"auto-sound": 0.8,
"auto-redirect": 0.8,
"auto-redirect-app-market": 0.8,
"auto-vibrate": 0.8,
"back-button-hijack": 0.8,
"blacklist": 0.8,
"browser-locker": 1,
"cryptocurrency-miner": 1,
"javascript-dialog-on-entry": 0.2,
"javascript-dialog-on-exit": 0.2,
"landing-page-error": 0.5,
"malicious-url": 1,
"malware": 1,
"potentially-unwanted-programs": 1,
"phishing-url": 1,
"ransomware": 1,
"scareware": 1,
"ssl-non-compliant": 0.8,
"uncommon-protocols": 0.8
}
Response status codes
Status code | Meaning |
---|---|
200 | Successful request, response payload with mentioned shape will be attached. |
Troubleshooting
Status code | Error message | Solution |
---|---|---|
400 | Bad Request | The body of the request is not a valid JSON format. |
401 | Unauthorized | Either the Authorization header is not sent or it has an incorrect value. |
403 | Forbidden | API key doesn't have the correct permissions for the endpoint. |