Admin API

Sorry, this page is not finished yet. You can see all entry points by using cli.php:

$ php bin/cli.php admin_api:routes                                                                                                        
+--------+-------------------------------------------------+------------------------------------+---
| Method | Route                                           | Description                        |  
+--------+-------------------------------------------------+------------------------------------+---
| GET    | /admin_api/v1/affiliate_networks                | Get list of affiliate networks     | + 
| GET    | /admin_api/v1/affiliate_networks/[i:id]         | Get affiliate network details      | +
| POST   | /admin_api/v1/affiliate_networks/[i:id]/clone   | Clone affiliate network            | +
| POST   | /admin_api/v1/affiliate_networks/[i:id]/archive | Clone affiliate network            | + 
| POST   | /admin_api/v1/affiliate_networks                | Create affiliate network           | + 
| PUT    | /admin_api/v1/affiliate_networks/[i:id]         | Update affiliate network           | +
| DELETE | /admin_api/v1/affiliate_networks/[i:id]         | Archive affiliate network          | + 
| GET    | /admin_api/v1/campaigns                         | Retrieve all campaigns             | +
| POST   | /admin_api/v1/campaigns/[i:id]/disable          | Disable a campaign                 | +
| GET    | /admin_api/v1/campaigns/[i:id]                  | Retrieve a specific campaign       | +
| POST   | /admin_api/v1/campaigns                         | Create a campaign                  | +
| PUT    | /admin_api/v1/campaigns/[i:id]                  | Update campaign                    | + 
| DELETE | /admin_api/v1/campaigns/[i:id]                  | Archive campaign                   | +
| GET    | /admin_api/v1/campaigns/deleted                 | Retrieve all deleted campaigns     | +
| POST   | /admin_api/v1/campaigns/[i:id]/restore          | Restore a deleted campaign         |
| POST   | /admin_api/v1/campaigns/[i:id]/enable           | Enable a campaign                  | +
| POST   | /admin_api/v1/campaigns/[i:id]/clone            | Clone a campaign                   | +
| POST   | /admin_api/v1/campaigns/[i:id]/update_costs     | Update campaign costs              | +
| POST   | /admin_api/v1/campaigns/[i:campaign_id]/update_cost | Update campaign cost           | +
| GET    | /admin_api/v1/campaigns/[i:campaign_id]/streams | Retrieve streams of a campaign     | +
| GET    | /admin_api/v1/clicks/log                        | Retrieve the clicks log            |
| GET    | /admin_api/v1/clicks/summary                    | Retrieve summary data              |
| GET    | /admin_api/v1/clicks/build                      | Build and retrieve a report        |
| GET    | /admin_api/v1/conversions/log                   | Retrieve the conversions log       |
| GET    | /admin_api/v1/landing_pages                     | Retrieve all landing pages         |
| GET    | /admin_api/v1/landing_pages/[i:id]              | Retrieve a specific langin page    |
| PUT    | /admin_api/v1/landing_pages/[i:id]/clone        | Clone a landing page               |
| POST   | /admin_api/v1/landing_pages                     | Create a landing page              |
| PUT    | /admin_api/v1/landing_pages/[i:id]              | Edit a landing page                |
| DELETE | /admin_api/v1/landing_pages/[i:id]              | Archive landing page               |
| GET    | /admin_api/v1/logs/[a:log]                      | Get log entries                    |
| GET    | /admin_api/v1/logs/types                        | Get log types                      |
| DELETE | /admin_api/v1/logs/[a:log]                      | Clear a log file                   |
| GET    | /admin_api/v1/offers                            | Get list of offers                 |
| GET    | /admin_api/v1/offers/[i:id]                     | Get a specific offer               |
| POST   | /admin_api/v1/offers                            | Create an offer                    |
| PUT    | /admin_api/v1/offers/[i:id]                     | Update an offer                    |
| POST   | /admin_api/v1/offers/[i:id]/clone               | Clone offer                        |
| DELETE | /admin_api/v1/offers/[i:id]/archive             | Move an offer to archive           |
| POST   | /admin_api/v1/report/build                      | Build a report                     |
| POST   | /admin_api/v1/streams                           | Create stream                      |
| GET    | /admin_api/v1/streams_actions                   | Retrieve stream actions            |
| DELETE | /admin_api/v1/streams/[i:id]                    | Move to archive a stream           |
| PUT    | /admin_api/v1/streams/[i:id]                    | Update a stream                    |
| GET    | /admin_api/v1/streams/deleted                   | Retrieve deleted streams           |
| GET    | /admin_api/v1/streams/[i:id]                    | Retrieve a specific stream         |
| POST   | /admin_api/v1/streams/[i:id]/restore            | Restore a deleted stream           |
| POST   | /admin_api/v1/streams/[i:id]/enable             | Enable a stream                    |
| POST   | /admin_api/v1/streams/[i:id]/disable            | Disable a stream                   |
| POST   | /admin_api/v1/streams/copy                      | Copy streams campaign              |
| POST   | /admin_api/v1/streams/move_streams              | Move streams                       |
| GET    | /admin_api/v1/streams/search                    | Search streams                     |
| GET    | /admin_api/v1/stream/:id/events                 | Retrieve stream events             |
| GET    | /admin_api/v1/stream_types                      | Retrieve available stream types    |
| GET    | /admin_api/v1/stream_schemes                    | Retrieve available stream schemes  |
| GET    | /admin_api/v1/traffic_sources                   | Retrieve all traffic sources       |
| GET    | /admin_api/v1/traffic_sources/[i:id]            | Retrieve a specific traffic source |
| POST   | /admin_api/v1/traffic_sources/[i:id]/clone      | Clone traffic source               |
| POST   | /admin_api/v1/traffic_sources                   | Create a traffic source            |
| PUT    | /admin_api/v1/traffic_sources/[i:id]            | Update a traffic source            |
| DELETE | /admin_api/v1/traffic_sources/[i:id]            | Move to archive a traffic source   |
+--------+-------------------------------------------------+------------------------------------+

All examples are written in PHP.

Authentication

To authorize, you must provide 'Api-Key' header.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api_endpoint_here');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

You must replace your-personal-api-key with your API key. To create a new API key visit Profile page in your Keitaro Admin area.

Affiliate Networks

Get All Affiliate Networks

This endpoint retrieves all affiliate networks.

GET /admin_api/v1/affiliate_networks

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/affiliate_networks');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

The above command returns JSON structured like this:

[
    {
        "created_at": "2016-11-19 11:17:45",
        "id": 1,
        "name": "bitterstrawberry.com",
        "postback_url": "",
        "state": "active",
        "template_name": "bitterstrawberrycom",
        "updated_at": "2017-03-28 19:55:13"
    },
    {
        "created_at": "2017-01-26 16:50:59",
        "id": 2,
        "name": "affiliatecube.com",
        "postback_url": "",
        "state": "active",
        "template_name": "affiliatecube",
        "updated_at": "2017-03-28 19:55:03"
    }
]

Get a Specific Affiliate Network

This endpoint retrieves a specific affiliate network.

GET /admin_api/v1/affiliate_networks/[i:id]
Param Description
id The ID of the affiliate network to retrieve

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/affiliate_networks/1');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Create an Affiliate Network

POST  /admin_api/v1/affiliate_networks
Param Description
name
postback_url Postback URL that must be added in the affiliate network

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/affiliate_networks');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_POST, 1);
$params = ["name" => "test", "postback_url" => "http://postback"];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
[
    {
        "id": "4",
        "name": "test",
        "postback_url": "http://postback",
        "state": "active",
        "template_name": "",
        "created_at": "2017-03-29 11:49:49",
        "updated_at": "2017-03-29 11:49:49"
    }
]

Update an Affiliate Network

This endpoint updates a affiliate network.

PUT  /admin_api/v1/affiliate_networks/[i:id]
Param Description
id ID of affiliate network
name New name
postback_url New Postback URL value

Example:

$params = ["name": "test2", "postback_url": "http://postback2"];
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/affiliate_networks/4');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
[
    {
        "id": "4",
        "name": "test2",
        "postback_url": "http://postback2",
        "state": "active",
        "template_name": "",
        "created_at": "2017-03-29 11:49:49",
        "updated_at": "2017-03-29 11:49:49"
    }
]

Clone an affiliate network

This endpoint clones an affilaite network.

POST  /admin_api/v1/affiliate_networks/[i:id]/clone
Param Description
id The ID of the affiliate network to retrieve

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '/admin_api/v1/affiliate_networks/1/clone');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response:

[
    {
        "created_at": "2017-03-29 11:49:49",
        "id": "3",
        "name": "bitterstrawberry.com Copy 29 Mar 2017 11:49",
        "postback_url": "",
        "state": "active",
        "template_name": "bitterstrawberrycom",
        "updated_at": "2017-03-29 11:49:49"
    }
]

Move to archive an affiliate network

This endpoint moves an affiliate network to archive.

POST  /admin_api/v1/affiliate_networks/[i:id]/archive
Param Description
id The ID of the affiliate network to retrieve

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/affiliate_networks/1');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response:

[
    {
        "id": "1",
        "name": "bitterstrawberry.com Copy 29 Mar 2017 11:49",
        "postback_url": "",
        "state": "deleted",
        "template_name": "bitterstrawberrycom",
        "created_at": "2017-03-29 11:49:49",
        "updated_at": "2017-03-29 11:49:49"
    }
]

Campaigns

Retrieve all Campaigns

This entry-point retrieves all the campaigns.

GET  /admin_api/v1/campaigns

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response:

[
    {
    "id": 89,
    "alias": "c8bL9W",
    "name": "Test cost1",
    "type": "position",
    "cookies_ttl": 24,
    "position": 1,
    "state": "active",
    "updated_at": "2017-02-13 16:48:19",
    "cost_type": "CPC",
    "cost_value": "10.0000",
    "cost_currency": "RUB",
    "group_id": null,
    "bind_visitors": null,
    "traffic_source_id": 1,
    "token": "5552798f1c388c8ade27c13ba47fe46090abd9d",
    "cost_auto": false
  }
]

Response fields described at section campaign_fields

Retrieve all deleted campaign

GET  /admin_api/v1/campaigns/deleted

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/deleted');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response the same as in the section retrieve_all_campaigns.

Disable a Campaign

POST  /admin_api/v1/campaigns/[i:id]/disable
Param Description
id Campaign ID

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/662/disable');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
echo curl_exec($ch);

Response:

[{
  "id": 662,
  "alias": "HBWgh8",
  "name": "Offers",
  "type": "weight",
  "cookies_ttl": 24,
  "position": 9999,
  "state": "disabled",
  "updated_at": "2017-05-03 20:39:16",
  "cost_type": "CPC",
  "cost_value": "0.0000",
  "cost_currency": "USD",
  "group_id": 71,
  "bind_visitors": "slo",
  "traffic_source_id": 1,
  "token": "47jmtgv14ldjdj7qbswwtmjjlg57xzg5",
  "cost_auto": true,
}]

Enable a campaign

POST  /admin_api/v1/campaigns/[i:id]/enable
Param Description
id Campaign ID

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/662/enable');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
echo curl_exec($ch);

Response:

[{
  "id": 662,
  "alias": "HBWgh8",
  "name": "Offers",
  "type": "weight",
  "cookies_ttl": 24,
  "position": 1,
  "state": "active",
  "updated_at": "2017-05-03 20:39:16",
  "cost_type": "CPC",
  "cost_value": "0.0000",
  "cost_currency": "USD",
  "group_id": 71,
  "bind_visitors": "slo",
  "traffic_source_id": 1,
  "token": "47jmtgv14ldjdj7qbswwtmjjlg57xzg5",
  "cost_auto": true,
}]

Retrieve a specific campaign

GET  /admin_api/v1/campaigns/[i:id]

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/89');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response:

{
    "id": 89,
    "alias": "c8bL9W",
    "name": "Test cost",
    "type": "position",
    "cookies_ttl": 24,
    "position": 1,
    "state": "active",
    "updated_at": "2017-02-13 16:48:19",
    "cost_type": "CPC",
    "cost_value": "10.0000",
    "cost_currency": "USD",
    "group_id": null,
    "bind_visitors": null,
    "traffic_source_id": 1,
    "token": "5552798f1c388c8ade27c13ba47fe46090abd9d",
    "cost_auto": false
  }

See descriptions of the response fields at section campaign_fields.

Create a campaign

POST  /admin_api/v1/campaigns

<a id=“campaign_fields”></a>

Param Description Required Default
alias Campaign alias which is used in URL http://domain.com/ALIAS) Yes
type Stream rotation type (position/weight) Yes position
name Campaign name Yes
cookies_ttl When click get uniqu status again (in hours) No 24
position Position in campaigns list No
state Campaign state (active/disabled/removed) No active
cost_type Cost type (CPC/CPUC/CPM) No CPC
cost_value Cost value No
cost_currency (EUR/USD/RUB/UAH/GBP) No Get from settings
cost_auto Enable automatic costs (0/1) No 0
group_id Campaign Group ID No null
bind_visitors Bind visitors feature (null - disabled/ s - only to streams/ sl - to streams and LPs/ slo — to streams, LPs and offers) No null
traffic_source_id Traffic Source ID No
token Token to gain access to Click API No

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
$params = [
    'name' => 'Test Campaign X',
    'alias' => 'test-campaign-x',
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); 
echo curl_exec($ch);

Response:

{
  "id": 734,
  "alias": "test-campaign-x",
  "name": "Test Campaign X",
  "type": "position",
  "cookies_ttl": 24,
  "position": 9999,
  "state": "active",
  "updated_at": null,
  "cost_type": "CPC",
  "cost_value": "0.0000",
  "cost_currency": "USD",
  "group_id": null,
  "bind_visitors": null,
  "traffic_source_id": null,
  "token": "4084055f1b4009b5c76e5f674779646b2da82df",
  "cost_auto": false
}

Update campaign

PUT /admin_api/v1/campaigns/734

See param descriptions at section campaign_fields

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POST, 1);
$params = [
    'name' => 'Test Campaign X2',
    'alias' => 'test-campaign-x2',
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); 
echo curl_exec($ch);

Response:

{
  "id": 734,
  "alias": "test-campaign-x2",
  "name": "Test Campaign X2",
  "type": "position",
  "cookies_ttl": 24,
  "position": 9999,
  "state": "active",
  "updated_at": null,
  "cost_type": "CPC",
  "cost_value": "0.0000",
  "cost_currency": "USD",
  "group_id": null,
  "bind_visitors": null,
  "traffic_source_id": null,
  "token": "4084055f1b4009b5c76e5f674779646b2da82df",
  "cost_auto": false
}

Archive a Campaign

DELETE /admin_api/v1/campaigns/[i:id]

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/734');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
echo curl_exec($ch);

Response:

[
  {
    "id": 734,
    "alias": "test-campaign-x2",
    "name": "Test Campaign X2",
    "type": "position",
    "cookies_ttl": 24,
    "position": 9999,
    "state": "deleted",
    "updated_at": "2017-06-01 13:46:20",
    "cost_type": "CPC",
    "cost_value": "0.0000",
    "cost_currency": "USD",
    "group_id": null,
    "bind_visitors": null,
    "traffic_source_id": null,
    "token": "4084055f1b4009b5c76e5f674779646b2da82df",
    "cost_auto": false
  }
]

Restore a Campaign

DELETE /admin_api/v1/campaigns/[i:id]

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/734/restore');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
echo curl_exec($ch);

Response:

[
  {
    "id": 734,
    "alias": "test-campaign-x2",
    "name": "Test Campaign X2",
    "type": "position",
    "cookies_ttl": 24,
    "position": 9999,
    "state": "active",
    "updated_at": "2017-06-01 13:46:20",
    "cost_type": "CPC",
    "cost_value": "0.0000",
    "cost_currency": "USD",
    "group_id": null,
    "bind_visitors": null,
    "traffic_source_id": null,
    "token": "4084055f1b4009b5c76e5f674779646b2da82df",
    "cost_auto": false
  }
]

Clone a campaign

POST /admin_api/v1/campaigns/[i:id]/clone

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/734/clone');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
echo curl_exec($ch);

Response:

[
  {
    "id": 735,
    "alias": "2nhpeS",
    "name": "Test Campaign X2 Copy",
    "type": "position",
    "cookies_ttl": 24,
    "position": 9999,
    "state": "active",
    "updated_at": "2017-06-01 13:46:20",
    "cost_type": "CPC",
    "cost_value": "0.0000",
    "cost_currency": "USD",
    "group_id": null,
    "bind_visitors": null,
    "traffic_source_id": null,
    "token": "1902eh90120981u23458u123",
    "cost_auto": false
  }
]

Update campaign costs

This endpoint updates campaign costs

POST /admin_api/v1/campaigns/[i:id]/update_costs
Param Description Required
id Campaign ID Yes
start_date Start date and time (Example, “2017-09-10 20:10”) Yes
end_date End date and time (Example, “2017-09-10 20:10”) Yes
timezone Timezone (Example, Europe/Madrid) No
cost Cost value (Example, 19.22) Yes
currency Currency (Example, EUR) No
only_campaign_uniques Apply costs only for unique clicks (1 or 0) No

Example:

$params = ['start_date' => '2017-09-10',
 'end_date' => '2017-09-12', 
 'cost' => 10.02, 
 'currency' => 'EUR',
 'timezone' => 'Europe/Moscow', 
 'only_campaign_uniques' => 1
];
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/2/update_costs');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response:

{"success":true}

Streams

Retrieve streams of a campaign

GET    | /admin_api/v1/campaigns/[i:campaign_id]/streams

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/admin_api/v1/campaigns/2/strems');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Response example for stream with schema “Redirect”:

[
  {
    "id": 1282,
    "type": "forced",
    "name": "Test Stream",
    "campaign_id": 2,
    "position": 1,
    "chance": 14,
    "action_options": null,
    "comments": "",
    "state": "active",
    "updated_at": "2016-08-20 15:30:04",
    "action_type": "http",
    "action_payload": "http:\/\/test.com",
    "schema": "redirect",
    "collect_clicks": true,
    "filter_or": true,
    "filters": [
      {
        "id": 386,
        "stream_id": 1282,
        "name": "uniqueness",
        "mode": "reject",
        "payload": "stream",
      }
    ],
    "triggers": [],
    "landings": [],
    "offers": []
  }
]

Response example for stream with schema “Landings”:

[
  {
    "id": 1282,
    "type": "regular",
    "name": "Test Stream",
    "campaign_id": 2,
    "position": 1,
    "chance": 14,
    "action_options": null,
    "comments": "",
    "state": "active",
    "updated_at": "2016-08-20 15:30:04",
    "action_type": "http",
    "action_payload": "http:\/\/test.com",
    "schema": "landings",
    "collect_clicks": true,
    "filter_or": false,
    "landings": [
      {
        "id": 46,
        "stream_id": 3659,
        "landing_id": 26,
        "state": "active",
        "share": 100,
        "created_at": "2017-05-23 11:34:17",
        "updated_at": "2017-05-23 11:55:00"
      }
    ],
    "offers": [
      {
        "id": 42,
        "stream_id": 3659,
        "offer_id": 3,
        "state": "active",
        "share": 0,
        "created_at": "2017-05-23 11:55:00",
        "updated_at": "2017-05-23 11:55:00"
      },
      {
        "id": 41,
        "stream_id": 3659,
        "offer_id": 4,
        "state": "active",
        "share": 100,
        "created_at": "2017-05-23 11:55:00",
        "updated_at": "2017-05-23 11:55:00"
      }
    ]
  }
]

Create a Stream

POST /admin_api/v1/streams

<a id=“stream-fields”></a> Params:

Param Description Required Default Value
campaign_id Campaign ID Yes
type Stream Type (regular/forced/default) Yes
name Stream Name No
position Position or stream weight No
action_options Action options (if action has options) No
comments Comments for stream No
state State of the stream (active/disabled/deleted) No active
action_type Action to perform (see 'Retrieve available stream action types') Yes
schema Stream schema (redirect/action/landings/offers) Yes
collect_clicks Stream collects clicks (true/false) No false
filter_or Use 'OR' relation between streams (true/false) No false
filters Stream filters (see section 'filters-block') No
triggers Stream triggers (see section 'triggers-block') No
landings Stream landings (see section 'landings-block') No
offers Stream offers (see section 'offers-block') No

<a id=“filters-block”></a> Fields of stream filters:

Param Description Required Default Value
id Stream Filter ID (provide it if you updates the filter) No
name Stream Filter Name (see section 'retrive-stream-filters') Yes
mode Filter mode (allow/reject) Yes
payload Stream payload. This field contains values for filters. For, example for filter “keyword” you can provide array ["value1", "value2"] No

<a id=“triggers-block”></a> Fields of stream triggers:

Param Description Required Default Value
id Trigger ID (provide if you want to update that exists)
condition Condtion (not_respond, always, not_contains, av_detected) Yes
target Target (stream, landings, offers, selected_page) Yes
selected_page Page URL to check No
pattern Text pattern to check
action Action (disable, replace_url, grab_from_page) Yes
interval Interval between checks No 60
alternative_urls URLs to replace (splitted by \n ) No
grab_from_page URL of page that contains new URL No
av_settings Settings for AV scanners
reverse Perform alsose in reverse mode (true/false) No false
scan_page AV scanner should scan the page content No

Why all the entry points triggers domain action?

If you user Single-click Installation before 10 April, you must make a change to the file /etc/nginx/conf.d/vhosts.conf.

Find the line:

location /admin {

and change it to

location /admin/ {

Why all the entry points return "404 NotFound"?