Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This feature is available for ClearLine account types.

Table of Contents

SDK Object Dictionary

Object: response from springserve.deal_id_lists.get(<id>)

NameAttribute/MethodArgumentsDescription
account_idattribute
SpringServe Account ID for object
activeattribute
Is Deal ID List active
bulk_createmethodlist[str]Add up to 10,000 values to a list
bulk_deletemethodlist[str]Remove up to 10,000 values to a list
bulk_replacemethodlist[str]Replace up to 10,000 values to a list
created_atattribute
When object was created
deleted_atattribute
When object was deleted
descriptionattribute
Optional description
duplicatemethodname: strCopies original object, returns new object. Specify name as argument to provide a name to the new list
get_listmethodNoneReturns object array of Deal ID Names
idattribute
ID of Deal ID List Object
ids_countattribute
Number of IDs stored
nameattribute
Name of Deal ID List
okattribute
Checks data types and values of object. If not ok, returns False.
pending_ids_countattribute
Number of Deal IDs in processing queue to be added to list
processed_ids_countattribute
Number of Deal IDs processed and added to list
rawattribute
Returns Dictionary of object
savemethodNoneMakes POST request to save object
statusattribute
Status of Pending/Processed IDs
updated_atattribute
When object was last updated

Creating a Deal ID List

SDK

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

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

 In
[2]: deal_id_list = ss.deal_id_lists.new({"name": "New Deal ID List"})
 
In [3]:
print (deal_id_list.ok, deal_id_list.id)
True 348

REST API

Method: POST

...

FieldData TypeRequiredNotes
namestringTrueList title
descriptionstringFalseAdd your own description
activeboolFalseDefault = true

Headers

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

Body (example)

Code Block
languagejs
themeRDark
{
  "name": "New Deal ID List"
}

Response: Status code 200

Code Block
languagejs
themeRDark
{
  "id": 348,
  "name": "New Deal ID List",
  "description": null,
  "account_id": 1,
  "active": true,
  "status": "completed",
  "ids_count": 0,
  "pending_ids_count": 0,
  "processed_ids_count": 0,
  "created_at": "2023-10-02T21:24:08.989Z",
  "updated_at": "2023-10-02T21:25:12.713Z",
  "deleted_at": null
}

...

Get a Deal ID List

SDK

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

In
[2]: deal_id_list = ss.deal_id_lists.get(348)
 
In [3]:
print (deal_id_list.name)
# Output
"New Deal ID List"

REST API

...

Endpoint: /api/v0/deal_id_lists/<id>

Headers:

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

Response: Status code 200

Code Block
languagejs
themeRDark
{
  "id": 348,
  "name": "New Deal ID List",
  "description": null,
  "account_id": 1,
  "active": true,
  "status": "completed",
  "ids_count": 0,
  "pending_ids_count": 0,
  "processed_ids_count": 0,
  "created_at": "2023-10-02T21:24:08.989Z",
  "updated_at": "2023-10-02T21:25:12.713Z",
  "deleted_at": null
}

Add Deal IDs

SDK

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

In
[2]:  deal_id_list = ss.deal_id_lists.get(348)

In [3]:

response = deal_id_list.bulk_create(['deal_id_1', 'deal_id_2'])

In
[4]:  print(response.ok)
True

REST API

...

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/bulk_create

Headers

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


Body (example)

Code Block
languagejs
themeRDark
{
  "deal_ids": ["deal_id_1", "deal_id_2"]
}

Response: Status code 200

Code Block
languagejs
themeRDark
{"created": True}

Add Deal IDs from a File

...

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/file_bulk_create

Code Block
languagebash
themeRDark
curl --location --request POST 'https://console.springserve.com/api/v0/deal_id_lists/<id>/deal_ids/file_bulk_create' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/appending_deal_id_list.csv"'

Response: Status code 201

Code Block
languagejs
themeRDark
{"created": True}


Replace Entire Deal ID List

SDK

Code Block
languagepy
themeRDark
import springserve as ss

deal_id_list = ss.deal_id_lists.get(348)

response = deal_id_list.bulk_replace(['new_deal_1', 'new_deal_2'])

print(response.ok)
# Output
True

REST API

Method: POST

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/bulk_replace

Headers

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

Body (example)

Code Block
languagejs
themeRDark
{
    "deal_ids": ["new_deal_1", "new_deal_2"]
}

Response: Status code 201

Code Block
languagejs
themeRDark
{"created": True}


Replace Entire Deal ID List with a File

...

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/file_bulk_replace

Code Block
themeRDark
curl --location --request POST 'https://console.springserve.com/api/v0/deal_id_lists/<id>/deal_ids/file_bulk_replace' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/replacement_deal_id_list.csv"'

Response: Status code 201

Code Block
languagejs
themeRDark
{"created": True}

Get Deal IDs in Deal ID List

SDK

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

In [2]:  did_list = ss.deal_id_lists.get(348)

In [3]:  list_values = did_list.get_list()

In [4]:
for i in valslist_values:
   ...:     	print(i["deal_id"])
Out [4]:
# Output
deal_id_1
deal_id_2
deal_id_3

...

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids

Headers

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

Response: Status code 200 (note: you need to paginate)

Code Block
languagejs
themeRDark
[
	{"deal_id": "deal_id_1"}, 
    {"deal_id": "deal_id_2"}
]

Remove Deal IDs

SDK

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

In
[2]:
deal_id_list = ss.deal_id_lists.get(348)

In [3]: response = deal_id_list.remove_names(['deal_id_2'])

In [4]: print(response.ok)
Out [4]:# Output
True

In
[5]: print (response.deleted)
# Output
True

REST API

Method: DELETE

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/bulk_delete

Headers

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

Body (example)

Code Block
languagejs
themeRDark
{
	"deal_ids": ["deal_id_2"]
}

Response: Status code 200 (note you need to paginate)


Code Block
languagejs
themeRDark
{"deleted": True}


Remove Deal IDs Using a File

Removes Deal IDs in the csv file from the list

...

Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/file_bulk_delete

Code Block
languagebash
themeRDark
curl --location --request POST 'https://console.springserve.com/api/v0/deal_id_lists/<id>/deal_ids/file_bulk_delete' \
--header 'Content-Type: application/json' \
--header 'Authorization: <yourAuthToken>' \
--form 'csv_file=@"/<filepath>/delete_these_deal_ids.csv"'

Response: Status code 200

Code Block
languagejs
themeRDark
{"deleted": True}


Target Deal IDs on a Demand Tag

To attach a Deal ID List to a demand tag, you must populate the "inventory_groups" object array.

SDK

In [1]:
Code Block
languagepy
themeRDark
import springserve as ss

In [2]:
tag = ss.demand_tags.get(1)

In
[3]: targeting_group = {
	"group": "1",
	"list_type": "white_list",
	"source_type": "list",
	"inventory_object": "DealIdList",
	"deal_id_list_ids": [348]
}

In
[3]:
tag.inventory_groups.append(targeting_group)

In
[4]: print(tag.save().ok)
# Output
True

REST API

See documentation on the Supply and Demand Tag APIs

...