Device ID Lists API
Device ID lists can be created, edited and viewed using the api. When you have created a device id list, you can attach that list to a demand or supply tag for targeting.
Creating a Device ID List
SDK
Use tab completion with SDK to auto-complete function names or show field options!
In [1]: import springserve In [2]: device_id_list = springserve.device_id_lists.new({"name":"My Test Device ID List"}) In [3]: print device_id_list.ok, device_id_list.id True 9
REST API
POST /api/v0/device_id_lists
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "name" : "My Device ID List" , "description": "My description" } |
Required parameters: name
Response
Status code 200
{ "id": 1, "account_id": 1, "name": "mine", "description": "devices", "active": true, "created_at": "2018-08-07T17:18:18.138Z" }
Get a Device ID List
SDK
In [1]: device_id_list = springserve.device_id_lists.get(9) In [2]: print device_id_list.name "My Test Device ID List"
REST API
GET /api/v0/device_id_lists/<id>
Headers
Content-Type application/json Authorization "yourAuthToken"
Response
Status code 200
{ "id": 3, "account_id": 1, "name": "My device id List", "description": "My description", "active": true, "created_at": "2018-08-08T17:19:44.516Z" }
Add a Device ID list
SDK
In [1]: device_id_list = springserve.app_lists.get(9) In [2]: add = device_id_list.device_ids(['fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f4', 'f525d6fe-19d0-4d37-b509-e25db9f82d87']) In [3]: print add.ok True
REST API
POST /api/v0/device_id_lists/<id>/device_ids/bulk_create
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "device_ids": ["fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f4", "f525d6fe-19d0-4d37-b509-e25db9f82d87"] }
Response
Status code 200
{"created": True}
Get Device ID's in a Device ID List
SDK
In [15]: resp = device_id_list.get_device_ids() In [16]: for d in resp: ....: print d.device_id ....: fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f4 f525d6fe-19d0-4d37-b509-e25db9f82d87
REST API
GET /api/v0/device_id_lists/<id>/device_ids
Headers
Content-Type application/json Authorization "yourAuthToken"
Response (note you need to pagenate)
Status code 200
{ "device_id": "fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f24" "device_id": "fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f25" }
Remove Device ID's
SDK
In [13]: device_id_list = springserve.device_id_lists.get(9) In [14]: resp = device_id_list.remove_device_ids(['f525d6fe-19d0-4d37-b509-e25db9f82d87']) In [15]: resp.ok Out [15]: True In [16]: print resp.deleted True
REST API
DELETE /api/v0/device_id_lists/<id>/device_ids/bulk_delete
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example) where "1" and "2" are the numeric
{ "device_id": "fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f24" "device_id": "fd5e1f3b-0a71-4fcc-8b9b-59da3a5a87f25" }
Response (note you need to pagenate)
Status code 200
{"deleted": True}
Attach to a Demand or Supply Tag
To attach an device id list to a supply or demand tag you must set the following fields on a supply or demand tag
- device_id_list_ids → this is a list of device id list ids that you want to target on the supply or demand tag
- device_id_targeting → Whether or not to treat it like a 'White List' or 'Black List'
SDK
In [18]: tag = springserve.demand_tags.get(2) In [19]: tag.device_id_list_ids.append(9) In [20]: tag.device_id_targeting = "White List" In [21]: print tag.save().ok True
REST API
See documentation on the Supply and Demand Tag APIs