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.
Table of Contents |
---|
...
Creating a domain list
SDK
Use tab completion with SDK to auto-complete function names or show field options!
Code Block |
---|
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
...
Code Block |
---|
{ "description": "My description", "id": 6114, "name": "My Test Domain List", "account_id": 1 } |
...
Get a domain list
SDK
Code Block |
---|
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>
...
Code Block |
---|
{ "description": "My description", "id": 6114, "name": "My Test Domain List", "account_id": 1 } |
...
Add Domains
SDK
Code Block |
---|
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
...
Status code 200
Code Block |
---|
{"created": 2} |
...
Get Domains in Domain List
SDK
Code Block |
---|
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
...
Code Block |
---|
[ {"id": 29070603, "name": "cnn.com"}, {"id": 29070604, "name": "abc.com"} ] |
...
Remove Domains
SDK
Code Block |
---|
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
...
Code Block |
---|
{"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
Code Block |
---|
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
...