Export data to CSV

This section describes how to save response data as in CSV format.

The ASoC API usually provides the data from responses in JSON format. This is useful if you handle the data programmatically. However, if you want to import the data to a spreadsheet (such as Excel), you might want to export the data from ASoC to a CSV file.
The response format is determined by the “Accept” HTTP header that the client sends in the request. By default, if no Accept header is provided, the response format will be JSON. To get the response in CSV format, the following header should be added to the request:
Accept: text/csv
Note that the ASoC API uses OData V4 for filtering and selecting the data that will be provided in the response. This also applies to responses in CSV format.

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