Versions Compared

Key

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

Segments can be created, edited, deleted and viewed using the following REST api instructions.  When you have created a segment, you can attach that list to a demand or supply tag for targeting. 

Creating a Segment

POST /api/v0/segments

Headers

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

Body (example)


Device ID Segment


{
  "name": "My Device Segment",
    "description": "My Device description",
    "segment_type”: "list",
    "segment_list_type”: "device_id"
}


Cookie ID Segment


{
  "name": "My Cookie ID Segment",
    "description": "My Cookie ID description"
    "segment_type”: "list",
    "segment_list_type”: "cookie"
}


...

Code Block
{
    "id": 10044,
    "account_id": 1,
    "name": "My DID Segment",
    "description": "My description",
    "active": true,
    "segment_type": "list",
    "segment_list_type": "cookie",
    "created_at": "2020-03-18T19:17:01.383Z"
}


Get a segment

GET /api/v0/segments/<id>

Headers

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

...

Code Block
{
    "id": 10044,
    "account_id": 1,
    "name": "My DID Segment",
    "description": "My description",
    "active": true,
    "segment_type": "list",
    "segment_list_type": "cookie",
    "created_at": "2020-03-18T19:17:01.383Z"
}

Add a Segment

POST /api/v0/segments/<id>/items/bulk_create

Headers

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

...

Code Block
{"created": True}

Add Items to a Segment using a File

REST API

POST /api/v0/segments/<id>/items/file_bulk_create

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

Response

Status code 201

Code Block
{"created": True}

Replace Entire Segment

REST API

POST /api/v0/app_name_lists/<id>/app_names/bulk_replace

Headers


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

Body (example)

Code Block
{
"items": ["item1", "item2"]
}

Response

Status code 201

Code Block
{"created": True}

...

Replaces segment with the items in the csv file

REST API

POST /api/v0/segments/<id>/items/file_bulk_replace

...

Code Block
{"created": True}

Get Device IDs or Cookies in a Segment 

GET /api/v0/segments/<id>/items

Headers

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

...

Code Block
[
    {
        "item": "d207654f-6bdd-474e-9734-67b7c3d02d96"
    },
    {
        "item": "d20gt57i-6bdd-474e-9734-67b7c3d02d96"
    }
]

Remove Device Ids or Cookies

DELETE /api/v0/segments/<id>/items/bulk_delete

Headers

...


Code Block
{
  "items": ["d207654f-6bdd-474e-9734-67b7c3d02d96"]
}

Response (note you need to pagenate)

Status code 200

Code Block
{"deleted": True}

Remove Items using a File

Removes items in the csv file from the segment

REST API

DELETE /api/v0/segments/<id>/items/file_bulk_delete

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

Response

Status code 200

Code Block
{"deleted": True}


Attach to a Demand or Supply Tag

See documentation on the Supply and Demand Tag APIs