Setting up your API environment

Use the SLAPI to manage file storage volumes, place orders, update authorizations, and query capacity through programmatic access to IBM Cloud services.

Before you begin, review the Introduction to the SL API in the API Reference. For more information about the File Storage for Classic service and available data types, see the SoftLayer_Network_Storage topic.

Setting up your environment with the SLAPI for Python client

You can pass your username and SL API Key every time you make an API request. You can also set your credentials as the environmental variables SL_USERNAME and SL_API_KEY, and create an environment that is only accessible from the IBM Cloud® private network, and a timeout of 4 minutes. See the following example.

$ export SL_USERNAME=YOUR_USERNAME
$ export SL_API_KEY=YOUR_API_KEY
$ python
>>> import SoftLayer
>>> client = SoftLayer.create_client_from_env(username='YOUR_USERNAME',api_key='YOUR_API_KEY', endpoint_url=SoftLayer.API_PRIVATE_ENDPOINT, timeout=240)

For day-to-day operation, you might find the managers in the API Python client to be the most convenient means for interacting with the API. Managers abstract many of the complexities of using the API into classes that provide a simpler interface to various services. To interact with File Storage for Classic services, import the FileStorageManager.

from SoftLayer import BlockStorageManager, FileStorageManager, Client

For more information, see SL API Client for Python and FileStorageManager topics.