Campaigns API

Creating a Campaign

REST API

POST /api/v0/campaigns

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)

{
    "name": "My Campaign",
    "has_rate": true,
    "rate": 10.00,
 
    "demand_partner_id": 52,

}

Required parameters: name, demand_partner_id

Note: if you want to set a rate, you must also set "has_rate": true

Response

Status code 200

{  
   "id":39,
   "account_id":1,
   "name":"My Campaign",
   "rate":10.0,
   "has_rate":true,
   "demand_partner_id":52,
   "code":null,
   "note":null,
   "is_active":true,
   "demand_tag_ids":[],
   "targeting_page_attribute_profile":{  
      "user_agent_devices":[],
      "user_agent_operating_systems":[],
      "detected_player_size_targeting":false,
      "player_sizes":[  
         "s",
         "m",
         "l",
         "u"
      ],
      "detected_domain_targeting":false,
      "domain_white_list":"",
      "domain_list_ids":[],
      "blocking_unknown_domains":false,
      "key_value_targeting":null,
      "key_values":null
   },
   "targeting_spend_profile":{  
      "budget_metric":null,
      "budget_period":null,
      "budget_pacing":null,
      "budget_value":null
   },
   "targeting_time_profile":{  
      "frequency_cap_period":null,
      "frequency_cap_metric":null,
      "frequency_cap_value":null,
      "start_date":null,
      "end_date":null,
      "day_parting":[]
   },
   "targeting_geo_profile":{  
      "country_white_list":"",
      "country_codes":[],
      "blocking_unknown_countries":false,
      "dma_white_list":"",
      "dma_codes":[],
      "state_white_list":"",
      "state_codes":[],
      "city_white_list":"",
      "city_codes":[],
      "postal_code_white_list":"",
      "postal_codes":[]
   }

}


Get a Campaign

REST API

GET /api/v0/campaigns/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Response

Status code 200

{  
   "id":39,
   "account_id":1,
   "name":"My Campaign",
   "rate":null,
   "has_rate":false,
   "demand_partner_id":52,
   "code":null,
   "note":null,
   "is_active":true,
   "demand_tag_ids":[],
   "targeting_page_attribute_profile":{  
      "user_agent_devices":[],
      "user_agent_operating_systems":[],
      "detected_player_size_targeting":false,
      "player_sizes":[  
         "s",
         "m",
         "l",
         "u"
      ],
      "detected_domain_targeting":false,
      "domain_white_list":"",
      "domain_list_ids":[],
      "blocking_unknown_domains":false,
      "key_value_targeting":null,
      "key_values":null
   },
   "targeting_spend_profile":{  
      "budget_metric":null,
      "budget_period":null,
      "budget_pacing":null,
      "budget_value":null
   },
   "targeting_time_profile":{  
      "frequency_cap_period":null,
      "frequency_cap_metric":null,
      "frequency_cap_value":null,
      "start_date":null,
      "end_date":null,
      "day_parting":[]
   },
   "targeting_geo_profile":{  
      "country_white_list":"",
      "country_codes":[],
      "blocking_unknown_countries":false,
      "dma_white_list":"",
      "dma_codes":[],
      "state_white_list":"",
      "state_codes":[],
      "city_white_list":"",
      "city_codes":[],
      "postal_code_white_list":"",
      "postal_codes":[]
   }

}

Add Demand Tags to your Campaign

REST API

PUT /api/v0/campaigns/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)

{
    "demand_tag_ids": [22312, 45923]

}

Note: The demand tags must have the same demand_partner_id as the campaign.

Response

Status code 200

{  
   "id":39,
   "account_id":1,
   "name":"My Campaign",
   "rate":null,
   "has_rate":false,
   "demand_partner_id":52,
   "code":null,
   "note":null,
   "is_active":true,
   "demand_tag_ids":[22312, 45923],
   "targeting_page_attribute_profile":{  
      "user_agent_devices":[],
      "user_agent_operating_systems":[],
      "detected_player_size_targeting":false,
      "player_sizes":[  
         "s",
         "m",
         "l",
         "u"
      ],
      "detected_domain_targeting":false,
      "domain_white_list":"",
      "domain_list_ids":[],
      "blocking_unknown_domains":false,
      "key_value_targeting":null,
      "key_values":null
   },
   "targeting_spend_profile":{  
      "budget_metric":null,
      "budget_period":null,
      "budget_pacing":null,
      "budget_value":null
   },
   "targeting_time_profile":{  
      "frequency_cap_period":null,
      "frequency_cap_metric":null,
      "frequency_cap_value":null,
      "start_date":null,
      "end_date":null,
      "day_parting":[]
   },
   "targeting_geo_profile":{  
      "country_white_list":"",
      "country_codes":[],
      "blocking_unknown_countries":false,
      "dma_white_list":"",
      "dma_codes":[],
      "state_white_list":"",
      "state_codes":[],
      "city_white_list":"",
      "city_codes":[],
      "postal_code_white_list":"",
      "postal_codes":[]
   }

}

Edit a Campaign

REST API

PUT /api/v0/campaigns/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)

{

    "has_rate": true,
    "rate": 5.00

}

Note:

  • If the rate for your campaign was previously null, to add a rate you must also set "has_rate": true
  • All the demand tags associated to your campaign will inherit this rate. 

Response

Status code 200

{  
   "id":39,
   "account_id":1,
   "name":"My Campaign",
   "rate":5.0,
   "has_rate":true,
   "demand_partner_id":52,
   "code":null,
   "note":null,
   "is_active":true,
   "demand_tag_ids":[],
   "targeting_page_attribute_profile":{  
      "user_agent_devices":[],
      "user_agent_operating_systems":[],
      "detected_player_size_targeting":false,
      "player_sizes":[  
         "s",
         "m",
         "l",
         "u"
      ],
      "detected_domain_targeting":false,
      "domain_white_list":"",
      "domain_list_ids":[],
      "blocking_unknown_domains":false,
      "key_value_targeting":null,
      "key_values":null
   },
   "targeting_spend_profile":{  
      "budget_metric":null,
      "budget_period":null,
      "budget_pacing":null,
      "budget_value":null
   },
   "targeting_time_profile":{  
      "frequency_cap_period":null,
      "frequency_cap_metric":null,
      "frequency_cap_value":null,
      "start_date":null,
      "end_date":null,
      "day_parting":[]
   },
   "targeting_geo_profile":{  
      "country_white_list":"",
      "country_codes":[],
      "blocking_unknown_countries":false,
      "dma_white_list":"",
      "dma_codes":[],
      "state_white_list":"",
      "state_codes":[],
      "city_white_list":"",
      "city_codes":[],
      "postal_code_white_list":"",
      "postal_codes":[]
   }

}