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.
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 |
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 } |
In [1]: app_bundle_list = springserve.app_bundle_lists.get(9) In [2]: print app_bundle_list.name "My Test App Bundle List" |
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 } |
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 |
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} |
Appends app bundles in the csv file to the list
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 |
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} |
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 |
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} |
Replaces app bundle list with the app bundles in the csv file
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 |
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} |
In [15]: resp = app_bundle_list.get_bundles() In [16]: for bundle in resp: ....: print bundle.app_bundle ....: app1 app2 |
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"} ] |
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 |
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} |
Removes app bundles in the csv file from the list
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 |
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} |
To attach an app bundle list to a supply or demand tag you must set the following fields on a supply or demand tag
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 |
See documentation on the Supply and Demand Tag APIs