Use tab completion with SDK to auto-complete function names or show field options!
In [1]: import springserve as ss In [2]: tag = ss.demand_tags.new({"name": "TEST API DOCS", "rate": 10.0, 'vast_endpoint_url': 'http://myvastendpoint.com/123', 'demand_partner_id':4321}) In [3]: print tag.ok, tag.id) True, 30424 |
POST /api/v0/demand_tags
cURL (example)
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Demand Tag - ClearLine API", "active": false, "demand_partner_id": 79715, "demand_class": 11, "format": "video", "bid_floor_type": "static", "rate": "20.0" }' |
Response
Status code 200
{ "id": 1472406, "account_id": 1215, "name": "Demand Tag - ClearLine API", "is_active": false, "note": null, "rate": "20.0", "player_size_targeting": "All", "player_sizes": [ "xs", "s", "m", "l", "xl", "u" ], ... } |
In [1]: import springserve as ss In [2]: tag = ss.demand_tags.get(1472406) In [3]: print(tag.name) Out[3]: "Demand Tag - ClearLine API" |
GET /api/v0/demand_tags/<id>
cURL (example):
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags/1472406' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' |
Response:
{ "id": 1472406, "account_id": 1215, "name": "Demand Tag - ClearLine API", "is_active": false, "note": null, "rate": "20.0", ... } |
In [1]: active_tags_by_account = ss.demand_tags.get(account_id=123, active=True) In [2]: print(active_tags_by_account[0].name) Out[2]: "TEST ACTIVE DEMAND TAG" |
GET /api/v0/demand_tags
cURL (example):
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags?active=false' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' |
Response
Status code 200
[ { "id": 1051320, "account_id": 1215, "name": "Line Item A", "is_active": false, ... }, { "id": 1051321, "account_id": 1215, "name": "Line Item B", "is_active": false, ... }, ... ] |
In [1]: tag = ss.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) Out[5]: "I want to change the name" |
PUT /api/v0/demand_tags/<id>
cURL (example):
Co curl --location --request PATCH 'https://console.clearline.magnite.com/api/v0/demand_tags/1472406' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Demand Tag - ClearLine API (With new name)" }' |
Response
Status code 200
{ "id": 1472406, "account_id": 1215, "name": "Demand Tag - ClearLine API (With new name)", "is_active": false, "note": null, "rate": "20.0", ... } |
Please note that this works for both Managed and Direct Connect tags.
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 |
GET /api/v0/demand_tags/<id>/duplicate
Headers
Content-Type application/json Authorization "yourAuthToken" |
Response
Status code 201
{ 'account_id': 1, 'active': True, 'demand_partner_id': 1764, 'id': 72302, 'name': 'I want to change the name (copy)', ... 'rate': '0.01', 'demand_tag_priorities': [{'supply_tag_id': 123456, 'priority': 1, 'tier': 0}, {'supply_tag_id': 123456, 'priority': 1, 'tier': 1}], 'vast_endpoint_url': 'http://test.com' } |
Min Bid Price and Max Bid Price need to be set when any of the following conditions are true:
Apply one or more Bid Modifiers
Fields in API:
bid_modifier_ids (Bid Shading)
rate (Bid Price)
min_bid_price (Min Bid Price)
max_bid_price (Max Bid Price)
SDK
import springserve as ss demand_tag = ss.demand_tags.new({ "name": "Bid Modifier Line Item", "is_active": False, "rate": "15.0", "active": False, "demand_partner_id": 79715, "demand_class": 11, "bid_floor_type": "static", "min_bid_price": "10.0", "max_bid_price": "20.0", "bid_modifier_ids": [1] }) |
REST API
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Bid Modifier Line Item", "is_active": false, "rate": "15.0", "active": false, "demand_partner_id": 79715, "demand_class": 11, "bid_floor_type": "static", "min_bid_price": "10.0", "max_bid_price": "20.0", "bid_modifier_ids": [1] }' |
Set Bid Shading = Enabled
This reveals the following pricing options:
Fields in API:
bid_shading (Bid Shading)
rate (Bid Price)
min_bid_price (Min Bid Price)
max_bid_price (Max Bid Price)
SDK
import springserve as ss demand_tag = ss.demand_tags.new({ 'name': "Bid Shading Line Item", 'rate': "10.0", 'bid_floor_type': 'static', 'format': 'video', 'bid_shading': True, 'min_bid_price': '9.0', 'max_bid_price': None, 'demand_class': 11, 'demand_partner_id': 79715, 'is_active': False }) |
REST API
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Bid Shading Line Item Example", "rate": "10.0", "bid_floor_type": "static", "format": "video", "bid_shading": true, "min_bid_price": "9.0", "max_bid_price": null, "demand_class": 11, "demand_partner_id": 79715, "is_active": false }' |
Setting Bid Type to Dynamic reveals the following pricing options:
Fields in API:
bid_floor_type (Bid Type)
bid_margin (Bid Percent Over Floor)
min_bid_price (Min Bid Price)
max_bid_price (Max Bid Price)
SDK
import springserve as ss demand_tag = ss.demand_tags.new({ "name": "Dynamic Bid Price Line Item - CL", "is_active": False, "active": False, "demand_partner_id": 79715, "demand_class": 11, "bid_floor_type": "dynamic", "bid_margin": 15.0, "format": "video", "min_bid_price": "1.0", "max_bid_price": "15.0", "buying_model": "private_market" }) |
REST API
curl --location 'https://console.clearline.magnite.com/api/v0/demand_tags' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Dynamic Bid Price Line Item - CL", "is_active": false, "active": false, "demand_partner_id": 79715, "demand_class": 11, "bid_floor_type": "dynamic", "bid_margin": 15.0, "format": "video", "min_bid_price": "1.0", "max_bid_price": "15.0", "buying_model": "private_market" }' |
Geo targeting can be applied at the following levels:
For each option, you can select the following:
If Include or Exclude are chosen, you must declare a source for the values that will be used. The options are as follows:
If "values" is the selected option, use the following objects:
If "list" is the selected option, use the following objects:
SDK
Target New York State, with the City Code of 5128581, and the Postal Code of 10001
import springserve as ss demand_tag = ss.demand_tags.new({ "name": "Line Item with GEO Targeting", "demand_partner_id": 79715, "is_active": False, "rate": "15.0", "active": False, "demand_class": 11, "bid_floor_type": "static", "format": "video", "buying_model": "private_market", "state_source": "values", "state_targeting": "Include", "state_codes": ["US-NY"], "state_lists": [], "state_list_ids": [], "city_source": "values", "city_targeting": "Include", "city_codes": [5128581], "city_lists": [], "city_list_ids": [], "postal_code_source": "values", "postal_code_targeting": "Include" "postal_codes": ["10001"], "postal_code_lists": [], "postal_code_list_ids": [] }) |
REST API
url --location 'https://console.clearline.magnite.com/api/v0/demand_tags' \ --header 'Authorization: authtokenhere' \ --header 'Content-Type: application/json' \ --data '{ "name": "Line Item with GEO Targeting", "demand_partner_id": 79715, "is_active": False, "rate": "15.0", "active": False, "demand_class": 11, "bid_floor_type": "static", "format": "video", "buying_model": "private_market", "state_source": "values", "state_targeting": "Include", "state_codes": ["US-NY"], "state_lists": [], "state_list_ids": [], "city_source": "values", "city_targeting": "Include", "city_codes": [5128581], "city_lists": [], "city_list_ids": [], "postal_code_source": "values", "postal_code_targeting": "Include" "postal_codes": ["10001"], "postal_code_lists": [], "postal_code_list_ids": [] }' |