/
Domain Lists API

Domain Lists API

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}

Append Domains to a Domain List From a File

REST API

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

curl --location --request POST 'https://console.springserve.com/api/v0/domain_lists/<id>/domains/file_bulk_create' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/domain_list.csv"'

Response

Status code 201

{"created": True}

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

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

Headers

Content-Type application/json
Authorization "yourAuthToken"

Body (example)

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

Replace All Domains with a File

REST API

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

curl --location --request POST 'https://console.springserve.com/api/v0/domain_lists/<id>/domains/file_bulk_replace' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/replacement_domain_list.csv"'

Response

Status code 201

{"created": True}

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}

Remove Domains in a File from a Domain List

REST API

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

curl --location --request POST 'https://console.springserve.com/api/v0/domain_lists/<id>/domains/file_bulk_delete' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/deletion_domain_list.csv"'

Response

Status code 201

{"created": True}


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 an 'Allowlist' or 'Blocklist'

SDK

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

REST API

See documentation on the Supply and Demand Tag APIs


Related content

Advertiser Domain Lists API
Advertiser Domain Lists API
More like this
App Bundle Lists API
App Bundle Lists API
More like this
IP Address Lists API
IP Address Lists API
More like this
Campaigns API
Read with this
CL -Domain Lists API
CL -Domain Lists API
More like this
Supply Partners API
Supply Partners API
Read with this