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

Domain lists can be created, edited and viewed using the domain list api.  When you have created a domain list, you can attach that domain list to a demand or supply tag for targeting. 



Creating a domain list

SDK

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

In [1]: import springserve

In [2]: domain_list = springserve.domain_lists.new({"name":"My Test Domain List"})

In [3]: print domain_list.ok, domain_list.id
True 6114

REST API

POST /api/v0/domain_lists

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)


{
    "name": "My Domain List",
        "description": "My description"
}


Required parameters: name

Response

Status code 200


{
 	"description": "My description", 
 	"id": 6114, 
	"name": "My Test Domain List", 
	"account_id": 1
}


Get a domain list

SDK

In [1]: domain_list = springserve.domain_lists.get(6114)

In [2]:print domain_list.name

"My Test Domain List"

REST API

GET /api/v0/domain_lists/<id>

Headers


Content-Type application/json
Authorization "yourAuthToken"

Response

Status code 200

{
 	"description": "My description", 
 	"id": 6114, 
	"name": "My Test Domain List", 
	"account_id": 1
}


Add Domains

SDK

In [1]:  domain_list = springserve.domain_lists.get(6113)

In [2]:  add = domain_list.add_domains(['cnn.com', 'abc.com'])


In [3]: add.ok
Out [3]: True
In [4]: print add.created

2

REST API

POST /api/v0/domain_lists/<id>/domains/bulk_create

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)


{
	"names": ["cnn.com", "abc.com"]
}


Response

Status code 200

{"created": 2}


Get Domains in Domain List

SDK

In [15]: resp = domain_list.get_domains() 

In [16]: for domain in resp:
   ....:     print domain.name
   ....:     
cnn.com
abc.com

REST API

GET /api/v0/domain_lists/<id>/domains

Headers

Content-Type application/json
Authorization "yourAuthToken"


Response (note you need to pagenate)

Status code 200

[
	{"id": 29070603, "name": "cnn.com"}, 
    {"id": 29070604, "name": "abc.com"}
]


Remove Domains

SDK

 In [13]: domain_list = springserve.domain_lists.get(6114)

 In [14]: resp = domain_list.remove_domains(['cnn.com'])


 In [15]: resp.ok
 Out [15]: True

 In [16]: print resp.deleted

 1

REST API

DELETE /api/v0/domain_lists/<id>/domains/bulk_delete

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)


{
	"names": ["cnn.com"]
}



Response (note you need to pagenate)

Status code 200

{"deleted": 1}


 

Attach to a Demand or Supply Tag

To attach a domain list to a supply or demand tag you must set the following fields on a supply or demand tag

  • domain_list_ids → this is a list of domain list ids that you want to target on the supply or demand tag
  • domain_targeting → Whether or not to treat it like a 'White List' or 'Black List'

SDK

In [18]: tag = springserve.demand_tags.get(2)

In [19]: tag.domain_list_ids.append(123)

In [20]: tag.domain_targeting = "White List"

In [21]: print tag.save().ok

True

REST API

See documentation on the Supply and Demand Tag APIs

 
  • No labels