Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: new references to file bulk updates and total replacement

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. 

...

Code Block
Content-Type application/json
Authorization "yourAuthToken"

Body (example)


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

Required parameters: name

Response

Status code 200

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"

...

Status code 200

Code Block
{"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

...

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
 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

Code Block
Content-Type application/json
Authorization "yourAuthToken"

Body (example)

Code Block
{
	"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

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

...

Status code 200

Code Block
{"deleted": 1}

...

Remove Domains in a File from a Domain List

REST API

POST /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

...

  • 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

Code Block
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

...