For operations that need multiple successful steps to be considered complete, you can run a transaction. The TransactionContextManager context is utilized with transactions to manage the REST interface requirements.

Example: Update a certificate and key without removing the pair from an SSL profile

>>> from f5.bigip import ManagementRoot
>>> from f5.bigip.contexts import TransactionContextManager
>>> mgmt = ManagementRoot('', 'user', 'pass', port=4443, token=True)
>>> mgmt.shared.file_transfer.uploads.upload_file(key)
>>> mgmt.shared.file_transfer.uploads.upload_file(cert)
>>> tx =
>>> with TransactionContextManager(tx) as api:
...     key ='{0}.key'.format(domain))
...     key.sourcePath = 'file:/var/config/rest/downloads/{0}'.format(os.path.basename(key))
...     key.update()
...     cert ='{0}.crt'.format(domain))
...     cert.sourcePath = 'file:/var/config/rest/downloads/{0}'.format(os.path.basename(cert))
...     cert.update()