Export data to CSV, JSON, or SARIF

This section describes how to export scan results as CSV, JSON, or SARIF.

The ASoC API returns data in JSON by default, which is useful for programmatic consumption. To explicitly request JSON, send the header:
Accept: application/json
If you need data in CSV (for spreadsheets), request CSV by sending:
Accept: text/csv
Note: the ASoC API supports OData V4 ($filter, $select) for filtering and selecting the fields returned; this applies to both JSON and CSV responses.

For SARIF: the UI provides an Export dialog that can produce SARIF for SAST issues (see the Export dialog in the product). If you need to generate SARIF programmatically via the API, SARIF output is produced by the Reports API (a different endpoint than the OData/export endpoints). See Export data to SARIF for API examples and parameters.

Using the API

To use the API, you must have a valid access token, and to get an access token, you need an API Key that is associated with your account. See Generating API Keys for details.

Swagger

To get the data in CSV format, simply change the default "Response Content Type" from "application/json" to "text/csv" before you click the "Execute" button.

For more details, refer to the Swagger documentation.

curl

The following is an example of a curl command that will return all the properties of all the applications you can access from your account (replace <access token> with a valid access token):
curl -X GET --header 'Accept: text/csv' --header 'Authorization: Bearer <access token>'
                    'https://cloud.appscan.com/api/v4/Apps'
Since the API supports OData, you can leverage the $filter and $select request parameters to get partial data. In the following example, only applications with High RiskRating are retrieved and each application contains 3 properties – Id, Name and RiskRating:
curl -X GET --header 'Accept: text/csv' --header 'Authorization: Bearer <access token>'
                    'https://cloud.appscan.com/api/v4/Apps?
                    $filter=RiskRating%20eq%20'\''High'\''&$select=Id%2CName%2CRiskRating' 

See also:

CSV format