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.
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 |
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 } |
In [1]: domain_list = springserve.domain_lists.get(6114) In [2]:print domain_list.name "My Test Domain List" |
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 } |
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 |
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} |
POST /api/v0/domain_lists/<id>/domains/file_bulk_create
|
Response
Status code 201
|
In [15]: resp = domain_list.get_domains() In [16]: for domain in resp: ....: print domain.name ....: cnn.com abc.com |
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"} ] |
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 |
POST /api/v0/domain_lists/<id>/domains/bulk_replace
Headers
Content-Type application/json Authorization "yourAuthToken" |
Body (example)
{ "names": ["replacement.com"] } |
POST /api/v0/domain_lists/<id>/domains/file_bulk_replace
|
Response
Status code 201
|
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 |
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} |
DELETE /api/v0/domain_lists/<id>/domains/file_bulk_delete
|
Response
Status code 201
|
To attach a domain list to a supply or demand tag you must set the following fields on a supply or demand tag
In [18]: tag = springserve.demand_tags.get(2) In [19]: tag.domain_list_ids.append(123) In [20]: tag.domain_targeting = "Allowlist" In [21]: print tag.save().ok True |
See documentation on the Supply and Demand Tag APIs