Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: sdk for bulk changes

...

Appends app bundles in the csv file to the list

SDK


Code Block
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

...

Replaces app bundle list with the app bundles in the csv file

SDK


Code Block
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

...

Get App Bundles in App Bundle List

SDK

Code Block
In [15]: resp = app_bundle_list.get_bundles() 

In [16]: for bundle in resp:
   ....:     print bundle.app_bundle
   ....:     
app1
app2

...

Code Block
[
	{"app_bundle": "app1"}, 
    {"app_bundle": "app2"}
]

Remove App Bundles

SDK

Code Block
 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

...


Code Block
{
	"app_bundles": ["app2"]
}

Response (note you need to paginate)

Status code 200

Code Block
{"deleted": True}

Remove App Bundles Using a File 

Removes app bundles in the csv file from the list

SDK


Code Block
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

Code Block
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

Code Block
{"deleted": True}


...

  • 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

Code Block
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

...