Common OData Query Parameters
The most common OData parameters seen in the ASoC API are:
- $top
- Used to limit the number of records returned by the system. Simply pass it an integer
and the API will take the value of $top and return at most that
number of records as determined by the
$orderby
parameter. For example, to return the first five scans:https://cloud.appscan.com/api/v4/Scans?$top=5
- $filter
- Defines which records are returned. If you provide this parameter an expression, every
record will be evaluated against it. All the records that evaluate to true for the
expression get returned. This filter parameter is very powerful and useful. For
example, to return all applications with High Risk rating:
https://cloud.appscan.com/api/v4/Apps?$filter=RiskRating+eq+'High'
- $select
- Defines which fields are included in the results. This is useful when you are
interested only in particular fields and don't want to include anything else. For
example, to the names and creation dates of all applications, but no other
information:
https://cloud.appscan.com/api/v4/Apps?$select=Name,DateCreated
- $skip
- Defines the number of records to skip. For example, to list all policies except the
first two:
https://cloud.appscan.com/api/v4/Policies?$skip=2
- $orderby
- Defines the order of the result set. You provide this parameter with a field and the
result set returned will be organized by the field in order. Order can be descending
or ascending, just like a SQL query, by appending
desc
orasc
to the parameter. String fields are ordered alphabetically; number fields, numerically. For example, to return a list of all scans, ordered by creation date descending:https://cloud.appscan.com/api/v4/Scans?$orderby=CreatedAt+desc
- $expand
-
Specifies the related resources to be included in line with retrieved resources. It also can be used to expand selected properties from the related resources. For example, to include only the Id and username of the user who created the scan:
https://cloud.appscan.com/api/v4/Scans?$expand=CreatedBy($select=Id,UserName)
- $apply
- Aggregation behavior is triggered using the query option
$apply
. It takes a sequence of set transformations, separated by forward slashes to express that they are consecutively applied, for example, the result of each transformation is the input to the next transformation. This is consistent with the use of service-defined bindable and composable functions in path segments. For example, to group applications that have Issues according to their RiskRating and return the number of apps per RiskRating:https://cloud.appscan.com/api/v4/Scans?$apply=filter(TotalIssues+gt+0)/groupby((RiskRating),aggregate($count+as+N))