CSV format
This section describes how to save response data as in CSV format.
Hierarchy
The CSV format does not support hierarchy, so to represent a model with hierarchy, the properties names in the CSV are concatenated with a dot (.) separating each hierarchy level.
[
{
"Name": "Scan1",
"LastSuccessfulExecution": {
"CreatedAt": "2021-04-18T07:13:58Z",
"Status": "Ready",
}
},
{
"Name": "Scan2",
"LastSuccessfulExecution": {
"CreatedAt": "2021-04-17T20:53:40.33Z",
"Status": "Ready",
}
}
]
Name,LastSuccessfulExecution.CreatedAt,LastSuccessfulExecution.Status,
Scan1,2021-04-18 07:13:58,Ready
Scan2,2021-04-17 20:53:40,Ready
Arrays
Array properties are not currently supported. If the returned model contains a property of type “array”, this property will be omitted when the response format is CSV.
Date and time
Date and time in a CSV response is always UTC.
Order of properties
- If the response contains all the properties and no $select parameter, the order of the properties will be followed in the sample JSON response (in the relevant function in swagger).
- If the response contains only selected properties (columns) using $select parameter, the order of the columns in the CSV will follow how the properties appear in the $select parameter.
- If the response contains an expanded property (using $expand parameter in the request), the columns that contain expanded properties will always appear before the other columns.
Encoding
The encoding of the CSV response body is UTF-8 with BOM at the beginning of the response.
Using this encoding, if the response is stored on a file with .csv extension, it can be opened from Excel and it supports Unicode characters.
Large data sets
The number of items that are returned by a single API call is limited to 30,000.
If the requested data exceeds this limit, only the first 30,000 items will be returned.
If the required data exceeds the limit, it can be retrieved using multiple requests of up to 10,000 items each.
This can be done by using the request parameters $top and $skip.
The $top determines how many items to retrieve. It is limited to 10,000 items.
The $skip determines how many items to skip.
$top=10000&$skip=
$top=10000&$skip=10000
$top=10000&$skip=20000
$top=10000&$skip=30000
$top=10000&$skip=40000
Note that for the last request only 5,000 items will be returned, showing that there are no more to retrieve.