V-Spark Online Help

Using cURL for REST API Testing

The JSON output that is produced by V‑Spark APIs is not easily readable by humans. When using cURL to make API calls, the output of the cURL command can be piped to Python in order to print that output in a more human-legible format, as in the following example:

cURL command | python -m json.tool


The json.tool module that is provided by Python sorts keys in JSON output alphabetically. If you want to reformat JSON output to make it more legible without reorganizing key values, consider using the Python command jsonlint. This command includes JSON reformatting along with JSON validation and other capabilities, and is provided as part of the python-demjson-2.2.2-1.el7.noarch package on CentOS 7 systems.

Obtaining and Using the cURL program

The cURL utility makes it easy to test using the V‑Spark API by providing a simple command-line mechanism for invoking API methods. cURL is not required to use the V‑Spark API, but it can be a helpful tool, even while developing a more programmatic implementation. The next few sections provide examples of using the V‑Spark API from the command line via the cURL command.

The cURL utility is freely available for operating systems including Linux, Windows, and macOS. The command for invoking the cURL utility is curl on Linux or Apple macOS systems. The executable command for invoking the cURL utility is curl.exe on Microsoft Windows systems.


When using cURL to make API calls, it is important to remember that because URLs typically include the '?' and '&' symbols to identify HTTP/HTTPS parameters, you must enclose the URL portion of your cURL command within quotation marks to prevent a Linux shell from intercepting and interpreting these characters.

In cURL examples and associated output that is provided in this document:

  • Escaped newlines (that is, lines in cURL commands or example output that end with a backslash) are added for readability. They must not be present in cURL commands, and are also not present in the output of those commands.

  • Example commands are shown in normal monospaced text. When example output from those commands is very short, it is combined into the same monospaced example block as the cURL call itself and is shown in bold, monospaced text. When example output from examples is verbose, that output is provided as a separate monospace example block.