This documentation provides detailed insights into the JSON configuration for querying data through a flexible API interface. The configuration incorporates filters, pagination, sorting, and date range specifications.
Input Details
Below, we provide different definitions and the structure for submitting data requests, which include optional and required parameters for filtering, sorting, and pagination.
Pagination (Optional)
Page Size (pageSize): Limits the number of records returned per response. Defaults to 10.
Page Number (pageNumber): Specifies the page number to return, starting from 0 by default.
Filters
The filter section specifies conditions to filter the dataset based on multiple fields, including
name
provider
providerAccountId
accruedCosts
priorPeriodCosts
changeCosts
providerResourceType
location
tags
vulnerabilities.name
owners.name
services.name
environments.name
Multiple comparison operators (eq, ne, in, nin, ilike) are used to refine the search criteria.
Schema Identifier (schemaIdentifier):
The required field identifies the schema used in the query. There are two main type of schemas:
Core schemas
Base schema name
Schema Identifier
Applications
schema-application
Base
schema-base
Costs
schema-cost
Environments
schema-environment
Libraries
schema-library
Manifests
schema-manifest
Owners
schema-owners
Persons
schema-person
Ranges
schema-range
Repositories
schema-repository
Resources
schema-resource
Scorecards
schema-scorecard
Scorecard Metrics
schema-scorecard-metric
Scorecard Metric Level
scorecard-metric-level
Scorecard Metric Results
schema-scorecard-metric-results
Services
schema-service
Teams
schema-team
Vulnerabilities
schema-vulnerabilities
User defined schemas
The other type for schemas are the ones that you created in your organization, you can find it from Settings -> Schemas
Relationships (Optional)
Relations (relations): Optional array specifying related data entities to include in the query results.
Sorting (Optional)
The sorting of query results can be controlled by specifying the field and direction of the sort.
Field: The field on which to sort the results. (Default to name)
Direction: The direction of the sort, either ASC (ascending) or DESC (descending). (Default to ASC)
Date Range (Optional)
Start Date (startDate): Optional start date for filtering the data.
End Date (endDate): Optional end date for filtering the data.
Filter Types
The filter can be specified using one or more conditions, which can be simple comparisons, logical AND, or logical OR operations.
Compare:
Defines a simple comparison filter. Specifies a comparison operation on a field.
Field: The name of the field to filter on.
Value: The value to compare against, which can be a single value, an array of values, or null.
Compare: The type of comparison (e.g., eq, ne)
Or and And:
Both interfaces define a logical grouping of conditions:
Type: Specifies whether the grouping is an AND or an OR operation.
Conditions: An array of And , Or , and Compare objects defining nested filters.
Example search body
Example 1 - Get the list of repositories that don't have any services
You can swap the compare property with any of the following:
ne
In this case, value property should be a single string or number, and the query builder will try to find all repositories whose related service's name is not equal to the provided value.
in
In this case, value property should be an array, and the query builder will try to find all repositories that have services with names that are in the provided list.
nin
This case works precisely in the opposite of the in operator.
ilike
To have the ability to find repositories that we only know part of their service's name, you can take advantage of the ilike For the wildcard, you can use %.
for example '%test-name%'
Example 2 - Use And and Or in one query
With the power of query builder, it's also possible to combine two different conditions; for example, you want to find all repositories that either no services nor owners.
This is an illustrative, not functional, example. Its goal is to provide a large list of filter conditions so you can copy and adapt parts of it to your needs.