App Bundle Lists API
App bundle lists can be created, edited and viewed using the api. When you have created an app bundle list, you can attach that list to a demand or supply tag for targeting.
Creating an App Bundle List
SDK
Use tab completion with SDK to auto-complete function names or show field options!
In [1]: import springserve In [2]: app_bundle_list = springserve.app_bundle_lists.new({"name":"My Test App Bundle List"}) In [3]: print app_bundle_list.ok, app_bundle_list.id True 9
REST API
POST /api/v0/app_bundle_lists
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "name" : "My App Bundle List" , "description": "My description" } |
Required parameters: name
Response
Status code 200
{ "account_id": 1, "active": True, "created_at": "2018-02-20T14:05:34.029Z", "description": "My description", "id": 9, "name": "My Test App Bundle List", "partial_match": False }
Get an App Bundle List
SDK
In [1]: app_bundle_list = springserve.app_bundle_lists.get(9) In [2]: print app_bundle_list.name "My Test App Bundle List"
REST API
GET /api/v0/app_bundle_lists/<id>
Headers
Content-Type application/json Authorization "yourAuthToken"
Response
Status code 200
{ "account_id": 1, "active": True, "created_at": "2018-02-20T14:05:34.029Z", "description": "My description", "id": 9, "name": "My Test App Bundle List", "partial_match": False }
Add App Bundles
SDK
Note: The size of the list supplied as argument to .add_bundles() method can only be 10,000 elements long. If you wish to add more than 10,000 bundles at once, chunk the lists into smaller lists.
In [1]: app_bundle_list = springserve.app_lists.get(9) In [2]: add = app_bundle_list.add_bundles(['app1', 'app2']) In [3]: print add.ok True
REST API
POST /api/v0/app_bundle_lists/<id>/app_bundles/bulk_create
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "app_bundles": ["app1", "app2"] }
Response
Status code 200
{"created": True}
Add App Bundles from a File
Appends app bundles in the csv file to the list
SDK
In [1]: app_bundle_list = springserve.app_bundle_lists.get(<id>) In [2]: add = app_bundle_list.bulk_create(file_path='/<filepath>/app_bundle_list.csv') In [3]: add.ok Out [3]: True In [4]: print add.created True
REST API
POST /api/v0/app_bundle_lists/<id>/app_bundles/file_bulk_create
curl --location --request POST 'https://console.springserve.com/api/v0/app_bundle_lists/<id>/app_bundles/file_bulk_create' \ --header 'Content-Type: application/json' \ --header 'Authorization: <yourAuthToken>' \ --form 'csv_file=@"/<filepath>/appending_app_bundle_list.csv"'
Response
Status code 201
{"created": True}
Replace Entire App Bundle List
SDK
In [13]: app_bundle_list = springserve.app_bundle_lists.get(<id>) In [14]: resp = app_bundle_list.bulk_replace(['com.bundle.app']) In [15]: resp.ok Out [15]: True
REST API
POST /api/v0/app_bundle_lists/<id>/app_bundles/bulk_replace
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "app_bundles": ["app1", "app2"] }
Response
Status code 201
{"created": True}
Replace Entire App Bundles with a File
Replaces app bundle list with the app bundles in the csv file
SDK
In [13]: app_bundle_list = springserve.app_bundle_lists.get(<id>) In [14]: resp = app_bundle_list.bulk_replace(file_path='/<filepath>/replacement_app_bundle_list.csv') In [15]: resp.ok Out [15]: True
REST API
POST /api/v0/app_bundle_lists/<id>/app_bundles/file_bulk_replace
curl --location --request POST 'https://console.springserve.com/api/v0/app_bundle_lists/<id>/app_bundles/file_bulk_replace' \ --header 'Content-Type: application/json' \ --header 'Authorization: <yourAuthToken>' \ --form 'csv_file=@"/<filepath>/replacement_app_bundle_list.csv"'
Response
Status code 201
{"created": True}
Get App Bundles in App Bundle List
SDK
In [15]: resp = app_bundle_list.get_bundles() In [16]: for bundle in resp: ....: print bundle.app_bundle ....: app1 app2
REST API
GET /api/v0/app_bundle_lists/<id>/app_bundles
Headers
Content-Type application/json Authorization "yourAuthToken"
Response (note you need to pagenate)
Status code 200
[ {"app_bundle": "app1"}, {"app_bundle": "app2"} ]
Remove App Bundles
SDK
In [13]: app_bundle_list = springserve.app_bundle_lists.get(9) In [14]: resp = app_bundle_list.remove_bundles(['app2']) In [15]: resp.ok Out [15]: True In [16]: print resp.deleted True
REST API
DELETE /api/v0/app_bundle_lists/<id>/app_bundles/bulk_delete
Headers
Content-Type application/json Authorization "yourAuthToken"
Body (example)
{ "app_bundles": ["app2"] }
Response (note you need to paginate)
Status code 200
{"deleted": True}
Remove App Bundles Using a File
Removes app bundles in the csv file from the list
SDK
In [13]: app_bundle_list = springserve.app_bundle_lists.get(<id>) In [14]: resp = app_bundle_list.bulk_delete(file_url='/<filepath>/deletion_app_bundle_list.csv') In [15]: resp.ok Out [15]: True In [16]: resp.deleted Out [16]: True
REST API
DELETE /api/v0/app_bundle_lists/<id>/app_bundles/file_bulk_delete
curl --location --request POST 'https://console.springserve.com/api/v0/app_bundle_lists/<id>/app_bundless/file_bulk_delete' \ --header 'Content-Type: application/json' \ --header 'Authorization: <yourAuthToken>' \ --form 'csv_file=@"/<filepath>/delete_these_app_bundles.csv"'
Response
Status code 200
{"deleted": True}
Attach to a Demand or Supply Tag
To attach an app bundle list to a supply or demand tag you must set the following fields on a supply or demand tag
- app_bundle_list_ids → this is a list of app bundle list ids that you want to target on the supply or demand tag
- app_bundle_targeting → Whether or not to treat it like an 'Allowlist' or 'Blocklist'
SDK
In [18]: tag = springserve.demand_tags.get(2) In [19]: tag.app_bundle_list_ids.append(9) In [20]: tag.app_bundle_targeting = "Allowlist" In [21]: print tag.save().ok True
REST API
See documentation on the Supply and Demand Tag APIs