V-Spark Online Help

Using the /list API with Python

The sample test script that was provided in Using GET with Python and the /config API was used to test the /config API. However, it can just as easily be used to query a V‑Spark installation and retrieve name-level information by specifying an API URL that begins with /list as the third parameter to the sample code, API-TO-CALL.

The sample code shown in this section uses the previously linked code to explore the /list API. The following code assumes that you have saved the previously linked code to a file named get-tests.py in the current directory and made that file executable.

Figure 1. Invoking the sample code to use the /list API
./get-tests.py HOST_NAME ROOT_TOKEN /list 200 config.json
./get-tests.py HOST_NAME ROOT_TOKEN /list/users 200 config-users.json
./get-tests.py HOST_NAME ROOT_TOKEN /list/orgs 200 config-orgs.json
./get-tests.py HOST_NAME ROOT_TOKEN /list/folders 200 config-folders.json
./get-tests.py HOST_NAME ROOT_TOKEN /list/apps 200 config-apps.json


To execute this snippet as directed, you would have to replace HOST_NAME with the name of the host on which your V‑Spark installation is running, and replace ROOT_TOKEN with the root token for your V‑Spark installation.

The examples in this section are fairly simple because the /list API only supports the GET HTTP method, and only returns name-level information.