...
This feature is available for ClearLine account types.
SDK Object Dictionary
Object: response from springserve.deal_id_lists.get(<id>)
Name | Attribute/Method | Arguments | Description |
---|
account_id | attribute |
| SpringServe Account ID for object |
active | attribute |
| Is Deal ID List active |
bulk_create | method | list[str] | Add up to 10,000 values to a list |
bulk_delete | method | list[str] | Remove up to 10,000 values to a list |
bulk_replace | method | list[str] | Replace up to 10,000 values to a list |
created_at | attribute |
| When object was created |
deleted_at | attribute |
| When object was deleted |
description | attribute |
| Optional description |
duplicate | method | name: str | Copies original object, returns new object. Specify name as argument to provide a name to the new list |
get_list | method | None | Returns object array of Deal ID Names |
id | attribute |
| ID of Deal ID List Object |
ids_count | attribute |
| Number of IDs stored |
name | attribute |
| Name of Deal ID List |
ok | attribute |
| Checks data types and values of object. If not ok, returns False. |
pending_ids_count | attribute |
| Number of Deal IDs in processing queue to be added to list |
processed_ids_count | attribute |
| Number of Deal IDs processed and added to list |
raw | attribute |
| Returns Dictionary of object |
save | method | None | Makes POST request to save object |
status | attribute |
| Status of Pending/Processed IDs |
updated_at | attribute |
| 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.
Code Block |
---|
| In [1]: |
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
...
Field | Data Type | Required | Notes |
---|
name | string | True | List title |
description | string | False | Add your own description |
active | bool | False | Default = true |
Headers
Code Block |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Body (example)
Code Block |
---|
|
{
"name": "New Deal ID List"
} |
Response: Status code 200
Code Block |
---|
|
{
"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
Code Block |
---|
| In [1]: |
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 |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Response: Status code 200
Code Block |
---|
|
{
"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
Code Block |
---|
| In [1]: |
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 |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Body (example)
Code Block |
---|
|
{
"deal_ids": ["deal_id_1", "deal_id_2"]
}
|
Response: Status code 200
Code Block |
---|
|
{"created": True} |
Add Deal IDs from a File
...
Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/file_bulk_create
Code Block |
---|
|
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 |
---|
|
{"created": True} |
Replace Entire Deal ID List
SDK
Code Block |
---|
|
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 |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Body (example)
Code Block |
---|
|
{
"deal_ids": ["new_deal_1", "new_deal_2"]
} |
Response: Status code 201
Code Block |
---|
|
{"created": True} |
Replace Entire Deal ID List with a File
...
Endpoint: /api/v0/deal_id_lists/<id>/deal_ids/file_bulk_replace
Code Block |
---|
|
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 |
---|
|
{"created": True} |
Get Deal IDs in Deal ID List
SDK
Code Block |
---|
| In [1]: |
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 |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Response: Status code 200 (note: you need to paginate)
Code Block |
---|
|
[
{"deal_id": "deal_id_1"},
{"deal_id": "deal_id_2"}
] |
Remove Deal IDs
SDK
Code Block |
---|
| In [1]: |
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 |
---|
|
Content-Type application/json
Authorization "yourAuthToken" |
Body (example)
Code Block |
---|
|
{
"deal_ids": ["deal_id_2"]
} |
Response: Status code 200 (note you need to paginate)
Code Block |
---|
|
{"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 |
---|
|
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 |
---|
|
{"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
Code Block |
---|
| In [1]: |
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
...