Campaign actions#
Four actions read and write your campaigns: siteGet, siteAdd, siteUpdate, siteDel. Campaign
fields are described in Campaign object.
siteGet#
Accepts both GET and POST. Query parameters, all optional:
| Parameter | Description |
|---|---|
filter |
Filter condition, see below |
page |
The page to fetch, starting at 1 |
limit |
Campaigns per page, default 100, maximum 500 |
filter takes three forms:
- Omitted: returns all campaigns, in creation order.
- Any string: campaigns whose
titleor URL contains that string. id:<number>: exactly one campaign by id, for examplefilter=id:812031.
Get the first 500 campaigns:
GET https://dash.9hits.com/api/siteGet?key=YOUR_API_KEY&limit=500&page=1
Filter by title or URL:
GET https://dash.9hits.com/api/siteGet?key=YOUR_API_KEY&filter=my-site.com
Get exactly one campaign by id:
GET https://dash.9hits.com/api/siteGet?key=YOUR_API_KEY&filter=id:812031
data is an array of campaigns:
{
"status": "ok",
"messages": ["Fetched 1"],
"data": [
{
"id": 812031,
"title": "My Site",
"urls": ["https://my-site.com"],
"duration": [59, 70],
"userState": "running",
"systemState": "approved"
}
]
}
siteAdd#
The body is JSON with the fields of the new campaign. title and urls are required. Fields you
don't send get their default values; for example, duration is [30, 60].
{
"title": "My Site",
"isAdult": false,
"hasCoinMining": false,
"urls": ["http://my-site.com/about.html"],
"duration": [30, 70]
}
siteUpdate#
The body is the same as for siteAdd, plus id (required) to select the campaign to change. This is
a partial update: send only the fields you want to change; fields you don't send keep their
current values. To clear a list (for example, to turn off the IP filter), send that field with an
empty value.
Add resetHitCounter: true (optional) to reset estimatedHits and confirmedHits to 0.
{
"id": 400466,
"title": "My New Site",
"urls": ["http://my-site.com/new-post1.html", "http://my-site.com/new-post2.html"],
"resetHitCounter": true
}
siteDel#
The body is an array of ids, not an object: