Page tree
Skip to end of metadata
Go to start of metadata



Creating a Demand Tag

SDK

Use tab completion with SDK to auto-complete function names or show field options!

In [1]: import springserve

In [2]: tag = springserve.demand_tags.new({"name": "TEST API DOCS", "rate": 10.0, 'vast_endpoint_url': 'http://myvastendpoint.com/123'})

In [3]: print tag.ok, tag.id
True, 30424

REST API

POST /api/v0/demand_tags

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)


{
    "name": "TEST API DOCS",
        "description": "My description"
}

Required parameters: name, rate, vast_endpoint_url, demand_partner_id

Response

Status code 200

{
  'account_id': 1,
  'active': True,
  'allowed_player_sizes': [
    's',
    'm',
    'l',
    'u'
  ],
  'bid_floor_type': 'dynamic',
  'bid_margin': 1.0,
  'bid_optional_params': {'context': 0},
  'bid_params': {'placementId': u'1'},
  'bid_platform': None,
  'budget_metric': None,
  'budget_pacing': None,
  'budget_period': None,
  'budget_value': None,
  'campaign_id': None,
  'country_codes': [],
  'country_targeting': 'All',
  'demand_code': None,
  'demand_group_id': None,
  'demand_partner_id': 1764,
  'tag_pixels': [],
  'demand_tag_type': 2,
  'demand_type': 2,
  'direct_connect': False,
  'dma_codes': [],
  'dma_targeting': u'All',
  'domain_list_ids': [],
  'domain_targeting': u'All',
  'end_date': None,
  'frequency_cap_metric': None,
  'frequency_cap_period': None,
  'frequency_cap_value': None,
  'id': 30424,
  'key_value_targeting': True,
  'name': 'TEST API DOCS',
  'player_size_targeting': 'All',
  'rate': '0.01',
  'start_date': None,
  'supply_tag_ids': [96296],
  'targeting_demand_ids': [],
  'targeting_demand_white_list': '',
  'timeout': 20000,
  'updated_at': '2017-07-28T15:06:47.191Z',
  'user_agent_devices': [],
  'user_agent_operating_systems': [],
  'vast_endpoint_url': 'http://test.com'
}

Get a demand tag by id

SDK

In [1]: tag = springserve.demand_tags.get(30424)

In [2]: print tag.name

"TEST API DOCS"


REST API

GET /api/v0/demand_tags/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Response

Status code 200

{
  'account_id': 1,
  'active': True,
  'allowed_player_sizes': [
    's',
    'm',
    'l',
    'u'
  ],
  'bid_floor_type': 'dynamic',
  'bid_margin': 1.0,
  'bid_optional_params': {'context': 0},
  'bid_params': {'placementId': u'1'},
  'bid_platform': None,
  'budget_metric': None,
  'budget_pacing': None,
  'budget_period': None,
  'budget_value': None,
  'campaign_id': None,
  'country_codes': [],
  'country_targeting': 'All',
  'demand_code': None,
  'demand_group_id': None,
  'demand_partner_id': 1764,
  'tag_pixels': [],
  'demand_tag_type': 2,
  'demand_type': 2,
  'direct_connect': False,
  'dma_codes': [],
  'dma_targeting': u'All',
  'domain_list_ids': [],
  'domain_targeting': u'All',
  'end_date': None,
  'frequency_cap_metric': None,
  'frequency_cap_period': None,
  'frequency_cap_value': None,
  'id': 30424,
  'key_value_targeting': True,
  'name': 'TEST API DOCS',
  'player_size_targeting': 'All',
  'rate': '0.01',
  'start_date': None,
  'supply_tag_ids': [96296],
  'targeting_demand_ids': [],
  'targeting_demand_white_list': '',
  'timeout': 20000,
  'updated_at': '2017-07-28T15:06:47.191Z',
  'user_agent_devices': [],
  'user_agent_operating_systems': [],
  'vast_endpoint_url': 'http://test.com'
}

Get demand tags based on multiple conditions

SDK

In [1]: active_tags_by_account = springserve.demand_tags.get(account_id=123, active=True)

In [2]: print active_tags_by_account[0].name

"TEST ACTIVE DEMAND TAG"

REST API

GET /api/v0/demand_tags/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body

{
  'account_id': 123,
  'active': True
}


Response

Status code 200

[
	{
  		'account_id': 123,
  		'active': True,
  		'allowed_player_sizes': ['s','m','l','u'],
  		'bid_floor_type': 'dynamic',
  		'bid_margin': 1.0,
  		'bid_optional_params': {'context': 0},
  		'bid_params': {'placementId': u'1'},
  		'bid_platform': None,
  		'budget_metric': None,
  		'budget_pacing': None,
  		'budget_period': None,
  		'budget_value': None,
  		'campaign_id': None,
  		'country_codes': [],
		'country_targeting': 'All',
  		'demand_code': None,
  		'demand_group_id': None,
  		'demand_partner_id': 1764,
  		'tag_pixels': [],
  		'demand_tag_type': 2,
  		'demand_type': 2,
  		'direct_connect': False,
  		'dma_codes': [],
  		'dma_targeting': u'All',
  		'domain_list_ids': [],
  		'domain_targeting': u'All',
  		'end_date': None,
  		'frequency_cap_metric': None,
  		'frequency_cap_period': None,
  		'frequency_cap_value': None,
  		'id': 30424,
  		'key_value_targeting': True,
  		'name': 'TEST ACTIVE DEMAND TAG',
  		'player_size_targeting': 'All',
  		'rate': '0.01',
  		'start_date': None,
  		'supply_tag_ids': [96296],
  		'targeting_demand_ids': [],
  		'targeting_demand_white_list': '',
  		'timeout': 20000,
  		'updated_at': '2017-07-28T15:06:47.191Z',
  		'user_agent_devices': [],
  		'user_agent_operating_systems': [],
  		'vast_endpoint_url': 'http://test.com'
	},
	{
		'account_id': 123,
  		'active': True,
  		'allowed_player_sizes': ['s','m','l','u'],
		...
	}
]

Edit a Demand Tag

SDK

In [1]: tag = springserve.demand_tags.get(30424)

In [2]: tag.name = "I want to change the name"

In [3]: changed = tag.save()


In [4]: changed.ok
Out [4]: True

In [5]: print changed.name

"I want to change the name"

REST API

PUT /api/v0/demand_tags/<id>

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)

{
    "name": "I want to change the name"
}


Response

Status code 200

{
  'account_id': 1,
  'active': True,
  'allowed_player_sizes': [
    's',
    'm',
    'l',
    'u'
  ],
  'bid_floor_type': 'dynamic',
  'bid_margin': 1.0,
  'bid_optional_params': {'context': 0},
  'bid_params': {'placementId': u'1'},
  'bid_platform': None,
  'budget_metric': None,
  'budget_pacing': None,
  'budget_period': None,
  'budget_value': None,
  'campaign_id': None,
  'country_codes': [],
  'country_targeting': 'All',
  'demand_code': None,
  'demand_group_id': None,
  'demand_partner_id': 1764,
  'tag_pixels': [],
  'demand_tag_type': 2,
  'demand_type': 2,
  'direct_connect': False,
  'dma_codes': [],
  'dma_targeting': u'All',
  'domain_list_ids': [],
  'domain_targeting': u'All',
  'end_date': None,
  'frequency_cap_metric': None,
  'frequency_cap_period': None,
  'frequency_cap_value': None,
  'id': 30424,
  'key_value_targeting': True,
  'name': 'I want to change the name',
  'player_size_targeting': 'All',
  'rate': '0.01',
  'start_date': None,
  'supply_tag_ids': [96296],
  'targeting_demand_ids': [],
  'targeting_demand_white_list': '',
  'timeout': 20000,
  'updated_at': '2017-07-28T15:06:47.191Z',
  'user_agent_devices': [],
  'user_agent_operating_systems': [],
  'vast_endpoint_url': 'http://test.com'
}

Duplicate a Demand Tag

Please note that this works for both Managed and Direct Connect tags. 

SDK

In [1]: tag = springserve.demand_tags.get(30424)

ln [2]: dupe = tag.duplicate()

ln [3]: dupe.ok
Out [3]: True

In [4]: print dupe.id
72302

REST API

GET /api/v0/demand_tags/<id>/duplicate

Headers

Content-Type application/json
Authorization "yourAuthToken"


Response

Status code 201

{
  'account_id': 1,
  'active': True,
  'allowed_player_sizes': [
    's',
    'm',
    'l',
    'u'
  ],
  'bid_floor_type': 'dynamic',
  'bid_margin': 1.0,
  'bid_optional_params': {'context': 0},
  'bid_params': {'placementId': u'1'},
  'bid_platform': None,
  'budget_metric': None,
  'budget_pacing': None,
  'budget_period': None,
  'budget_value': None,
  'campaign_id': None,
  'country_codes': [],
  'country_targeting': 'All',
  'demand_code': None,
  'demand_group_id': None,
  'demand_partner_id': 1764,
  'tag_pixels': [],
  'demand_tag_type': 2,
  'demand_type': 2,
  'direct_connect': False,
  'dma_codes': [],
  'dma_targeting': u'All',
  'domain_list_ids': [],
  'domain_targeting': u'All',
  'end_date': None,
  'frequency_cap_metric': None,
  'frequency_cap_period': None,
  'frequency_cap_value': None,
  'id': 72302,
  'key_value_targeting': True,
  'name': 'I want to change the name',
  'player_size_targeting': 'All',
  'rate': '0.01',
  'start_date': None,
  'supply_tag_ids': [96296],
  'targeting_demand_ids': [],
  'targeting_demand_white_list': '',
  'timeout': 20000,
  'updated_at': '2017-07-28T15:06:47.191Z',
  'user_agent_devices': [],
  'user_agent_operating_systems': [],
  'vast_endpoint_url': 'http://test.com'
}
  • No labels