Traffic Controls

Operations for traffic controls

Traffic Controls are a powerful way to filter traffic based on variables. You can find out more about traffic filters on the Helpdesk.

They can target one or multiple affiliates and one or multiple offers.


Find All

GET /v1/networks/trafficcontrols

This endpoint can be used to fetch all traffic controls. Note that if there are lots of traffic controls in your account, it might be preferable to use the Find (Advanced) endpoint documented below.

Important : This response from this endpoint does not return a “complete” traffic control object. The variables and actual blocked values are not returned here. You must use the Find By ID endpoint to get a complete version of the object.

Paging

This endpoint supports paging. Refer to our User Guide for usage.

Filters

This endpoint supports the following API filters. Refer to our User Guide for usage.

Value Description
time_created The time at which the traffic control was created
time_saved The time at which the traffic control was last modified
status active or inactive

cURL
curl --request GET 'https://api.eflow.team/v1/networks/trafficcontrols' \
--header 'X-Eflow-API-Key: <INSERT API KEY>'
Response
{
  "traffic_controls": [
    {
      "network_traffic_control_id": 1,
      "network_id": 1,
      "name": "Traffic Control Name",
      "status": "active",
      "is_apply_all_affiliates": true,
      "is_apply_all_offers": false,
      "control_type": "blacklist",
      "targeting_action": "block",
      "date_valid_from": "",
      "date_valid_to": "",
      "comparison_method": "exact_match",
      "time_created": 1614267736,
      "time_saved": 1614267736,
      "relationship": {
        "network_offer_ids": [
          4
        ],
        "network_affiliate_ids": null,
        "network_advertiser_ids": null,
        "offers": [
          {
            "network_offer_id": 4,
            "network_id": 1,
            "name": "Example Offer Name",
            "offer_status": "active"
          }
        ]
      }
    },
    {
      "network_traffic_control_id": 2,
      "network_id": 1,
      "name": "Traffic Control Name #2",
      "status": "active",
      "is_apply_all_affiliates": false,
      "is_apply_all_offers": true,
      "control_type": "blacklist",
      "targeting_action": "fail_traffic",
      "date_valid_from": "2021-06-01",
      "date_valid_to": "2021-06-30",
      "comparison_method": "ends_with",
      "time_created": 1614267894,
      "time_saved": 1614267894,
      "relationship": {
        "network_offer_ids": null,
        "network_affiliate_ids": [
          21,
          14
        ],
        "network_advertiser_ids": null,
        "affiliates": [
          {
            "network_affiliate_id": 14,
            "network_id": 1,
            "name": "Bill Alston Inc.",
            "account_status": "active"
          },
          {
            "network_affiliate_id": 21,
            "network_id": 1,
            "name": "Miwa Olsen Inc.",
            "account_status": "active"
          }
        ]
      }
    }
  ],
  "paging": {
    "page": 1,
    "page_size": 10,
    "total_count": 2
  }
}

Find (Advanced)

POST /v1/networks/trafficcontrolstable

Paging

This endpoint supports paging. Refer to our User Guide for usage.

Body Params

search_terms object array
search_type string

The name of the field used for search. The only supported value is currently : name.

value string

The value to search.

filters object
status string

Status of the traffic controls. Can be one of the following values: active, inactive.

network_offer_ids int array

IDs of the offers affected by the traffic controls (traffic controls that apply to all offers will be included)

network_affiliate_ids int array

IDs of the affiliate affected by the traffic controls (traffic controls that apply to all affiliates will be included)

Body Example
{
  "search_terms": [
    {
      "search_type": "name",
      "value": "search query",
    }
  ],
  "filters": {
    "status": "active",
    "network_affiliate_ids": [],
    "network_offer_ids": [ 1 ]
  }
}

cURL
curl --request POST 'https://api.eflow.team/v1/networks/trafficcontrolstable' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'
Response
{
  "controls": [
    {
      "network_traffic_control_id": 1,
      "network_id": 1,
      "name": "Traffic Control Name",
      "status": "active",
      "is_apply_all_affiliates": true,
      "is_apply_all_offers": false,
      "control_type": "blacklist",
      "time_created": 1614267736,
      "time_saved": 1614267736,
      "network_offer_ids": [
        4
      ],
      "network_affiliate_ids": null,
      "network_advertiser_ids": null
    },
    {
      "network_traffic_control_id": 2,
      "network_id": 1,
      "name": "Traffic Control Name #2",
      "status": "active",
      "is_apply_all_affiliates": false,
      "is_apply_all_offers": true,
      "control_type": "blacklist",
      "time_created": 1614267894,
      "time_saved": 1614267894,
      "network_offer_ids": null,
      "network_affiliate_ids": [
        21,
        14
      ],
      "network_advertiser_ids": null
    }
  ],
  "paging": {
    "page": 1,
    "page_size": 50,
    "total_count": 2
  }
}

Find By ID

GET /v1/networks/trafficcontrols/:trafficControlId

This is the endpoint that will return the “complete” version of a traffic control, including the variables and the values that are blocked

Path Parameters

Parameter Description
trafficControlId The ID of the traffic control you want to fetch

cURL
curl --request GET 'https://api.eflow.team/v1/networks/trafficcontrols/1' \
--header 'X-Eflow-API-Key: <INSERT API KEY>'
Response

In this example the traffic control is date bound and affects specific offer IDs and affiliate IDs. The response will vary based on your definition.

 {
  "network_traffic_control_id": 1,
  "network_id": 1,
  "name": "Traffic Control Name",
  "status": "active",
  "is_apply_all_affiliates": false,
  "is_apply_all_offers": false,
  "control_type": "blacklist",
  "targeting_action": "block",
  "date_valid_from": "2021-03-01",
  "date_valid_to": "2021-03-31",
  "comparison_method": "exact_match",
  "variables": [
    "sub1",
    "sub2"
  ],
  "time_created": 1614267736,
  "time_saved": 1614270820,
  "relationship": {
    "network_offer_ids": [
      4,
      2
    ],
    "network_affiliate_ids": [
      28,
      21
    ],
    "network_advertiser_ids": null,
    "values": [
      "blocked_subid_val_1",
      "blocked_subid_val_2",
      "blocked_subid_val_3"
    ],
    "offers": [
      {
        "network_offer_id": 4,
        "network_id": 1,
        "name": "Example Offer Name",
        "offer_status": "active"
      },
      {
        "network_offer_id": 2,
        "network_id": 1,
        "name": "Example Offer Name 2",
        "offer_status": "active"
      }
    ],
    "affiliates": [
      {
        "network_affiliate_id": 28,
        "network_id": 1,
        "name": "Aki Cantrell Inc.",
        "account_status": "active"
      },
      {
        "network_affiliate_id": 21,
        "network_id": 1,
        "name": "Miwa Olsen Inc.",
        "account_status": "active"
      }
    ]
  }
}

Create

POST /v1/networks/trafficcontrols

Body Params

name string

Name of the traffic control.

status string

Status of the traffic control. Can be one of the following values: active or inactive.

is_apply_all_affiliates boolean

When this is false, the network_affiliate_ids array must be filled

network_affiliate_ids int array

The affiliate IDs that will be affected by the traffic control (only relevant when is_apply_all_affiliates is set to false)

is_apply_all_offers boolean

When this is false, the network_offer_ids or network_advertiser_ids array must be filled

network_offer_ids int array

The offers IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false).

network_offer_ids int array

The advertiser IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false). All offers for the specified advertiser IDs will be affected.

control_type string

Traffic controls can be either whitelist or blacklist.

targeting_action string

The targeting action can be either block or fail_traffic

date_valid_from string

An optional start date after which the traffic control will be enforced. Use the YYYY-MM-DD format.

date_valid_to string

An optional end date after which the traffic control will no longer be enforced. Use the YYYY-MM-DD format.

comparison_method string

Defines how the variables will be compared. Can be one of : exact_match, contains, begins_with, ends_with, does_not_contain or does_not_match

variables string array

The click variable that will be looked up and compared to the values supplied. Can be one or multiple values among : sub1, sub2, sub3, sub4, sub5, source_id, referrer, isp

values string array

The values that the traffic control will filter. Limited to 3000 values when using exact_match and 100 values otherwise. Please note that when using a whitelist, all values besides the ones specified here will be blocked / sent to fail traffic

Body Example
{
    "name": "Traffic Control Example",
    "status": "active",
    "control_type": "blacklist",
    "targeting_action": "block",
    "comparison_method": "exact_match",
	"is_apply_all_affiliates": false,
	"is_apply_all_offers": false,
    "variables": [
    	"source_id",
		"sub3"
    ],
    "network_offer_ids": [
		5
    ],
    "network_affiliate_ids": [
        7,
		14,
		21
    ],
    "network_advertiser_ids": [],
    "values": [
        "Blocked Source 1",
		"Blocked Source 2"
    ]
}

cURL
curl --request POST 'https://api.eflow.team/v1/networks/trafficcontrols' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'
Response
{
  "network_traffic_control_id": 3,
  "network_id": 1,
  "name": "Traffic Control Example",
  "status": "active",
  "is_apply_all_affiliates": false,
  "is_apply_all_offers": false,
  "control_type": "blacklist",
  "targeting_action": "block",
  "date_valid_from": "",
  "date_valid_to": "",
  "comparison_method": "exact_match",
  "variables": [
    "sub3",
    "source_id"
  ],
  "time_created": 1614273013,
  "time_saved": 1614273013,
  "relationship": {
    "network_offer_ids": [
      4
    ],
    "network_affiliate_ids": [
      21,
      7,
      14
    ],
    "network_advertiser_ids": null,
    "values": [
      "Blocked Source 2",
      "Blocked Source 1"
    ],
    "offers": [
      {
        "network_offer_id": 4,
        "network_id": 1,
        "name": "Offer Name",
        "offer_status": "active"
      }
    ],
    "affiliates": [
      {
        "network_affiliate_id": 21,
        "network_id": 1,
        "name": "Miwa Olsen Inc.",
        "account_status": "active"
      },
      {
        "network_affiliate_id": 7,
        "network_id": 1,
        "name": "Gabielle Hensley Inc.",
        "account_status": "active"
      },
      {
        "network_affiliate_id": 14,
        "network_id": 1,
        "name": "Bill Alston Inc.",
        "account_status": "active"
      }
    ]
  }
}

Update

PUT /v1/networks/trafficcontrols/:trafficControlId

Update an existing traffic control.

You must specify all the fields, not only the ones you wish to update.
If you omit a field that is not marked as required, its default value will be used.

Path Parameters

Parameter Description
trafficControlId The ID of the traffic control you want to update

Body Params

network_traffic_control_id int

The unique ID of the traffic control.

name string

Name of the traffic control.

status string

Status of the traffic control. Can be one of the following values: active or inactive.

is_apply_all_affiliates boolean

When this is false, the network_affiliate_ids array must be filled

network_affiliate_ids int array

The affiliate IDs that will be affected by the traffic control (only relevant when is_apply_all_affiliates is set to false)

is_apply_all_offers boolean

When this is false, the network_offer_ids or network_advertiser_ids array must be filled

network_offer_ids int array

The offers IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false).

network_offer_ids int array

The advertiser IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false). All offers for the specified advertiser IDs will be affected.

control_type string

Traffic controls can be either whitelist or blacklist.

targeting_action string

The targeting action can be either block or fail_traffic

date_valid_from string

An optional start date after which the traffic control will be enforced. Use the YYYY-MM-DD format.

date_valid_to string

An optional end date after which the traffic control will no longer be enforced. Use the YYYY-MM-DD format.

comparison_method string

Defines how the variables will be compared. Can be one of : exact_match, contains, begins_with, ends_with, does_not_contain or does_not_match

variables string array

The click variable that will be looked up and compared to the values supplied. Can be one or multiple values among : sub1, sub2, sub3, sub4, sub5, source_id, referrer, isp

values string array

The values that the traffic control will filter. Limited to 3000 values when using exact_match and 100 values otherwise. Please note that when using a whitelist, all values besides the ones specified here will be blocked / sent to fail traffic

Body Example
{
    "network_traffic_control_id": 1,
    "name": "Traffic Control Example",
    "status": "active",
    "control_type": "blacklist",
    "targeting_action": "block",
    "comparison_method": "exact_match",
	"is_apply_all_affiliates": false,
	"is_apply_all_offers": false,
    "variables": [
    	"source_id",
		"sub3"
    ],
    "network_offer_ids": [
		5
    ],
    "network_affiliate_ids": [
        7,
		14,
		21
    ],
    "network_advertiser_ids": [],
    "values": [
        "Blocked Source 1",
		"Blocked Source 2"
    ]
}

cURL
curl --request PUT 'https://api.eflow.team/v1/networks/trafficcontrols/1' \
--header 'X-Eflow-API-Key: <INSERT API KEY>' \
--header 'Content-Type: application/json' \
--data '<INSERT BODY HERE>'
Response
{
  "network_traffic_control_id": 1,
  "network_id": 1,
  "name": "Traffic Control Example",
  "status": "active",
  "is_apply_all_affiliates": false,
  "is_apply_all_offers": false,
  "control_type": "blacklist",
  "targeting_action": "block",
  "date_valid_from": "",
  "date_valid_to": "",
  "comparison_method": "exact_match",
  "variables": [
    "sub3",
    "source_id"
  ],
  "time_created": 1614267736,
  "time_saved": 1614273498,
  "relationship": {
    "network_offer_ids": [
      4
    ],
    "network_affiliate_ids": [
      21,
      7,
      14
    ],
    "network_advertiser_ids": null,
    "values": [
      "Blocked Source 2",
      "Blocked Source 1"
    ],
    "offers": [
      {
        "network_offer_id": 4,
        "network_id": 1,
        "name": "Offer Name",
        "offer_status": "active"
      }
    ],
    "affiliates": [
      {
        "network_affiliate_id": 21,
        "network_id": 1,
        "name": "Miwa Olsen Inc.",
        "account_status": "active"
      },
      {
        "network_affiliate_id": 7,
        "network_id": 1,
        "name": "Gabielle Hensley Inc.",
        "account_status": "active"
      },
      {
        "network_affiliate_id": 14,
        "network_id": 1,
        "name": "Bill Alston Inc.",
        "account_status": "active"
      }
    ]
  }
}

Delete

DELETE /v1/networks/trafficcontrols/:trafficControlId

Delete an existing traffic control.

Path Parameters

Parameter Description
trafficControlId The ID of the traffic control you want to delete

cURL
curl --request DELETE 'https://api.eflow.team/v1/networks/trafficcontrols/1' \
--header 'X-Eflow-API-Key: <INSERT API KEY>'
Response
{
  "success": true
}