ScroogeFroge™ API for Traffic Audit

Query format

Queries are made in JSON format by sending POST request to http://a.scroogefrog.com/api/
JSON contains of 3 mandatory parameters: id, md5, task and optional additional parameters, specific for evert method.
First two parameters contains authentification data. Parameter task - contains API method.

Answer format

Answer consists of JSON object.
In case of successful query, response object contains property 'ok', that contains answer in its value.
In case of error during query, response object contains property 'error', that contains error description in its value.
The only exeption is add_sites method, which returns array of objects descripted above.

Activating API

To activate API please contact support.

Authorization

Authorization is made thought sending user id(given to user during API activation) and md5 from password in json parameter id and md5.

API limits

It's prohibited to make more than 60 queries per minute.
In case of breaking this limit user will be blocked for one minute.
In case of breaking limits more that 60 times a day - API will be disabled and could be enabled back only after contacting support.
Using get_stat method with parameter stype=1 or stype=2 counts as 10 queries.
get_stat method with parameter stype=3 can't be used more than one time a day for one site.

Methods

get_audit_balance
Returns Traffic Audit balance.

Additional parameters:

  • none
Query example:
curl -d '{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"get_audit_balance"}'
Answer example:
{
    "ok": "8000.00"
}


get_sites_audit_status
Returns Traffic Audit status for sites.

Additional parameters:

  • none
Query example:
curl -d
'{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"get_sites_audit_status"}'
Answer example:
{
    "ok": {
        "1": {
            "id": "1",
            "domain": "example.com",
            "state": "OFF"
        },
        "2": {
            "id": "2",
            "domain": "example.org",
            "state": "ON"
        }
    }
}
Answer description:
  • id - Site ID in system
  • domain - Site domain
  • state - Traffic Audit state
    • ON - Audit ON
    • OFF - Audit OFF
    • NO MONEY - Audit OFF, no money on Audit balance
    • NO CODE - Audit OFF, no code on pages


get_site_audit_status
Returns Traffic Audit status for site

Additional parameters:

  • site_id - Site ID, returned in answer of get_sites_audit_status method
Query example:
curl -d
'{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"get_site_audit_status",
"site_id":1}'
Answer example:
{
    "ok": "NO CODE",
    "info": [{
        "url": "http:\/\/example.com\/page1",
        "js_code": 1,
        "php_code": 0
    }, {
        "url": "http:\/\/example.org\/page2",
        "js_code": -1,
        "php_code": 1
    }]
}
Answer description:
  • ok - Traffic Audit state
    • ON - Audit ON
    • OFF - Audit OFF
    • NO MONEY - Audit OFF, no money on Audit balance
    • NO CODE - Audit OFF, no code on pages
  • info - Is present only in case of NO CODE state, contains of array of pages with node code
    • url - page url
    • js - if 1, no js on page
    • php - if 1, no php on page


get_ban_limits
Return ban limits

Additional parameters:

  • none
Query example:
curl -d '{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"get_ban_limits"}'
Answer example:
{
    "ok": {
        "uid_ban_limit": "-8",
        "pads_visits_limit": "10",
        "pad_ban_limit": "-3.30"
    }
}
Answer description:
  • uid_ban_limit - Boundary ranking of user UID
  • pads_visits_limit - Min amount of visits for ciunting Pad ranking
  • pad_ban_limit - Boundary ranking of PAD


set_ban_limits
Sets ban limits

Additional parameters:

  • uid_ban_limit - Boundary ranking of user UID (int)[-50;-3]
  • pads_visits_limit - Min amount of visits for ciunting Pad ranking (int)[5;50]
  • pad_ban_limit - Boundary ranking of PAD (float)[-4;-2.5]
Query example:
curl -d '{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"set_ban_limits",
"uid_ban_limit": "-8","pads_visits_limit": "10","pad_ban_limit": "-3.30"}'
Answer example:
Same as method get_ban_limits


start_stop_audit
Stop or Start Traffic Audit

Additional parameters:

  • site_id - site ID, return by get_sites_audit_status method
  • state - ON - turn ON, OFF - turn OFF
Query example:
curl -d '{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"start_stop_audit",
"site_id": "2","state": "ON"}'
Answer example:
{
    "ok": "ON"
}


add_sites
Add site to Traffic Audit

Additional parameters:

  • urls - array of sites for adding
Query example:
curl -d '{"id":1,"md5":"e10adc3949ba44ff883e","task":"add_sites",
"urls":["example.org","exaple.com"]}'
Answer example:
{
    [{
        "ok": 100
    }, {
        "error": "WRONG URL"
    }]
}
Answer description:
    Ansfer contains array of results of adding in sites in the same order as query
  • ok - site added succesfully, returns its ID
  • error - error


check_code
Check if there is code on page

Additional parameters:

  • url - page url
Query example:
curl -d '{"id":1,"md5":"2e676f870f840d33448fa6718cc89db2","task":"check_code",
"url":"example.org/12?d=e"}
Answer example:
{
    "ok": {
        "php": 1,
        "js": 0
    }
}
Answer description:
  • php - existance of php code: 1 - code exists, 0 - no code
  • js - existance of javascript code: 1 - code exists, 0 - no code


get_stat
Get site stat

Additional parameters:

  • site_id - site ID, return in answer of get_sites_audit_status method/li>
  • stype - statistics type
    • 1 - fraud IP for time range(not more than 31 day)
    • 2 - fraud pads for time range(not more than 31 day)
    • 3 - full statics for the all time
  • from - begining of time range in UNIX TIMESTAMP(if stype 1 or 2)
  • to - end of time range in UNIX TIMESTAMP(if stype 1 or 2)
Query example:
curl -d '{"id":1,"md5":"e10adc3949ba44ff883e","task":"get_stat","site_id":1,"stype":1,
"from":1385501505,"to":1385541505}'
Answer example (stype=1):
{
    "ok": [
        ["1385537718", "93.127.125.94", 
	"example.org\/?_openstat=YmVndW47MzAyMDAwNDUyOzMwMjAwMDQ1ODs", 
	"begun machinelife.ru", "4"],
        ["1385530612", "209.85.238.9", 
	"example.org\/?utm_source=trafmag&utm_medium=click&tracking=1043", 
	"trafmag (\u043f\u0443\u0441\u0442 \u0440\u0435\u0444\u0435\u0440) 1043", "1"],
        ["1385505224", "66.249.93.44", 
	"example.org\/?utmka=lalala&keyword&site=example.org", 
	"batterfliay.ru", "16"],
        ["1385504840", "192.168.1.153", 
	"example.org\/?utm_source=trafmag&utm_campaign=trafmag&tracking=944", 
	"trafmag (\u043f\u0443\u0441\u0442 \u0440\u0435\u0444\u0435\u0440) 944", "4"],
        ["1385503928", "46.30.167.204", 
	"example.org\/?utm_source=trafmag&utm_medium=click&utm_campaign=trafmag", 
	"trafmag (\u043f\u0443\u0441\u0442 \u0440\u0435\u0444\u0435\u0440) 185", "3"],
        ["1385503418", "66.249.81.44", 
	"example.org\/?utmka=lalala&keyword&site=5864f0a8cffd909f.anonymous.google", 
	"5864f0a8cffd909f.anonymous.google", "1"]
    ]
}
Answer description (stype=1):
    Array of values by columns
  • 1 - time UNIX TIMESTAMP
  • 2 - IP
  • 3 - target page
  • 4 - pad
  • 5 - number of visits


Answer example (stype=2):
{
    "ok": [
        ["2013-11-27", "adwords mail.google.com",
	"example.com\/?utmka=lalala&keyword=&site=mail.google.com", "1"],
        ["2013-11-27", "begun rating.openstat.ru",
	"example.com\/?_openstat=YmVndW47MzAyMDAwNDUyOzMwMjAwMTE2MD", "1"],
        ["2013-11-27", "google.com example.org",
	"example.com\/?utmka=lalala&keyword=&site=example.org", "25"],
        ["2013-11-26", "google.com example.org",
	"example.com\/?utmka=lalala&keyword=&site=example.org", "25"]
    ]
}
Answer description (stype=2):
    Array of values by columns
  • 1 - date
  • 2 - pad
  • 3 - target page
  • 4 - numer of visits


Answer example (stype=3):
{
    "ok": [
        ["1369297040", "armyansk.info", "0", "77.52.191.86", "B5368",
	"example.org\/?_openstat=YmVndW47MzE0NTQ4NTQ4OzMxNDU0ODU3MDs",
	"0,03", "armyansk.info\/transport\/train-schedule"],
        ["1369297510", "ru.podii.com.ua", "0", "195.24.157.158", "B5372",
	"example.org\/?_openstat=YmVndW47MzE0NTQ4NTQ4OzMxNDU0ODU3MDs",
	"0,03", "ru.podii.com.ua\/business\/2013\/05\/23\/103707.html"],
        ["1369299042", "smotri.com", "-2.69444", "193.108.171.116", "A2008879",
	"example.org\/?_openstat=YmVndW47MzE0NTQ4NTQ4OzMxNDU0ODU3MDs",
	"0,03", "smotri.com\/live\/00kleopatra00"],
    ]
}
Answer description (stype=3):
    target page
  • 1 - time UNIX TIMESTAMP
  • 2 - pad
  • 3 - pad ranking
  • 4 - IP
  • 5 - user ID
  • 6 - target page
  • 7 - price
  • 8 - referer


Error codes

  • WRONG TASK — incorrect API method
  • REQUEST METHOD SHOULD BE POST — HTTP Request method is not POST
  • ZERO CONTENT LENGTH — HTTP header CONTENT LENGTH is 0 or absent
  • MALFORMED JSON — malformed JSON
  • ONE OF THE NECESSARY PARAMETERS IS MISSING — missing id,md5 or task parametr
  • API DISABLED OR AUTH ERROR – API disabled, or wrong pair of id,md5
  • API ABUSE. API DISABLED — systematicaly breaking API limits. API disabled.
  • API LIMIT REACHED. BANNED FOR 1 MINUTE — breaking API limits. API disabled for 1 minute.
  • WRONG SITE ID — wrong site ID
  • WRONG URL and WRONG URL FORMAT — incorrect URL
  • URL ALREADY IN USE. PLEASE ADD IN INTERFACE. — this URL is already in system. If it's added not by you but you are the owner - add it throungt web interface
  • SYSTEM ERROR, TRY AGAIN — system error, tyy again
  • NO MONEY — to turn the Audit on refill the balance
  • NO CODE — no code on page(s). To turn the Audit on put the code on listed pages
  • WRONG STATE — incorrect value of state para,etr. acceptable value: ON or OFF
  • NOTHING TO SET – you should define at least one ban parameter
  • WRONG pad_ban_limit FORMAT — Incorrect parametr value. Parametr should be float.
  • WRONG pads_visits_limit FORMAT — Incorrect parametr value. Parametr should be integer
  • WRONG uid_ban_limit_error FORMAT — Incorrect parametr value. Parametr should be integer
  • WRONG pad_ban_limit VALUE. SHOULD BE BETWEEN -4 AND -2.5 — Incorrect parametr value. Value should be in range from -4 to -2.5
  • WRONG pads_visits_limit VALUE. SHOULD BE BETWEEN 5 AND 50 — Incorrect parametr value. Value should be in range from 5 to 50
  • WRONG pads_visits_limit VALUE. SHOULD BE BETWEEN -50 AND -3 — Incorrect parametr value. Value should be in range from -50 to -3
  • SITE NOT IN SYSTEM и SITE DOESN'T BELONG TO USER — site doesn't added to Traffic Audit
  • SITE DOWN — page unavailable or doesn't exists
  • WRONG stype — Incorrect parameter value. Value should be 1,2 or 3
  • TOO BIG DATA RANGE — Too big time range. Range should be not more than 31 day
  • DAY STAT LIMIT REACHED — You can aquire full site statics more than once a day

Conditions of use Cookies by Scroogefrog.com system

Hide