Filter Exposure Data

Overview

The Moody's Risk Modeler API supports query string parameters that provide you with better control over the data returned from a resource. Query string parameters are especially useful in top-level resources that return lists of exposure objects such as lists of accounts, profiles, or treaties.

A query string parameter is a type of REST API parameter that is appended to a resource endpoint. Where the endpoint defines the path to a resource, the query string parameter controls the scope or order of the data returned from that resource.

Use query string parameters to select an exposure data module to query; and to filter, sort, and paginate the data returned from that data source. The query string parameter is appended to the service endpoint using the ? character.

Synopsis

RMS Risk Modeler supports five basic query string parameters: datasource, q, sort, limit, and offset.

GET /resource-path

?

datasource= edm-name

[ q= attribute [ LIKE ] attribute-value ]

[ sort= attribute= ASC | DESC ]

[ limit= number]

[ offset= number]

Every query string parameter is defined by a parameter keyword, a query string, and a comparison operator (=) that connects the parameter keyword to the query string. You can use the & operator to append multiple query string parameters to the endpoint.

?
The ? character must precede the query string.
datasource
A datasource query string parameter specifies the EDM to query. The datasource query string parameter is required in all Risk Modeler API calls. As many of our customers maintain multiple EDMs, many Risk Modeler services require that a dataSourceName ) be specified as a query parameter in the service endpoint.
q
A q query string parameter defines an attribute value filter that selects the records returned from the resource. The attribute value filter is an expression that consists of an attribute, an attribute value, and a comparison operator ( = or LIKE ). You can define complex queries by linking multiple expressions together using logical operators ( AND or OR ).
sort
A sort query string parameter specifies an attribute on which to sort and the sort order (alphabetical or numerical) for the records returned from the service. One of ASC for ascending or DESC for descending.
limit
A limit query string parameter specifies the number of records to display per page. By default, 100.
offset
An offset query string parameter specifies the number of pages that are offset before the initial page of records returned. By default, 0.

Data source queries

The datasource query string parameter identifies a specific data source (EDM) to query.

GET /portfolios?datasource=api_edm_3

Many tenants manage their exposure data in multiple EDM data sources. Consequently, the datasource query string parameter is generally required when requesting data from a resource.

Query filters

The q parameter keyword enables you to define a query string parameter that selects records using attribute value filters and comparison operators. Multiple expressions may be linked together using logical operators.

  • A basic query consists of a single expression that defines an attribute, a condition (an attribute value), and a comparison operator (= or LIKE).
  • A complex query links together two or more expressions using one or more logical operators (AND or OR)

Comparison operators

The q keyword supports comparative queries that return records that match a specified attribute values. These queries support six operators.

The query consists of the q keyword, an attribute, a comparison operator, and a condition that specifies an attribute value. The query compares the value of the specified attribute in each record with the value of the specified condition and selects records that match. Attribute value strings are not case sensitive.

GET /portfolios?datasource=ds1&limit=3&sort=number ASC&q=number LIKE "Portfolio_*"

Risk Modeler supports the = != > < LIKE and NOT LIKEoperators.

  • The = operator selects records with attribute values that exactly match a specified attribute value. The = comparison operator may be used to select records attribute values that match strings and numbers.
  • The != operator selects records with attribute values that do not match the specified attribute value. The != comparison operator may be used to filter records based on string or number values.
  • The > operator selects records with numerical attribute values that are greater than the specified attribute value.
  • The < operator selects records with numerical attribute values that are less than than the specified attribute value.
  • The LIKE operator selects records with attribute values that match the specified string pattern. The asterisk character (*) may be used as a wildcard character to represent zero or more characters. The LIKE operator may be used to compare strings and numbers.
  • The NOT LIKE operator selects records with attribute values that do not match the specified string pattern. The asterisk character (*) may be used as a wildcard character to represent zero or more characters. The NOT LIKE operator may be used to compare strings and numbers.

List operators

The q keyword supports queries that return records that based on values that are or are not is a specified list of attribute values.

  • The IN operator selects records with attribute values that match an attribute value specified in a list of attribute values. The IN operator may be used to compare strings and numbers.
  • The NOT IN operator selects records with attribute values that do not match an attribute value specified in a list of attribute values. The IN operator may be used to compare strings and numbers.

Logical operators

Some Risk Modeler API services enable you to create complex queries by stringing together multiple attribute value filters using logical operators. The q keyword supports logical queries that return records based on complex queries that compare the value of expresssions.

A logical operator is a keyword that connects two or more expressions to create a compound expression.

GET /portfolios?datasource=ds1&limit=3&sort=number ASC&q=number LIKE "Portfolio_*" AND (description = 1) OR (ownerName ="roland_alphonso")

The Risk Modeler API enables you to create complex expressions using the AND and the OR logical operators:

  • In an complex expression using the AND logical operator, both expressions must be true for the complex expression to be true.
  • In an complex expression using the OR logical operator, either expression may be true for the complex expression to be true.

Exposure attribute filters

The Risk Modeler API supports query filters for a limited number of exposure attributes. Depending on the exposure type (account, aggregate portfolio, portfolio, and treaty), records could be filtered using query parameters.

Your ability to filter exposures, the comparison operators supported, depend on the data type of the attribute. Risk Modeler API supports the filtering of strings, dates, and numbers.

Accounts

The Search Accounts operation returns a list of accounts. This operation supports complex queries based the following properties and a combination of comparison operators, list operators, and logical operators.

PropertyData TypeComparisonListLogical
accountidNumber=, !=, >, <, >=, <=IN, NOT INAND, OR
accountNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
accountNumberString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
branchNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
cedantNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
effectiveDateFromYYYY-MM-DD=, !=, >, <, <=AND, OR
effectiveDateToYYYY-MM-DD=, !=, >, <, <=AND, OR
expirationDateToYYYY-MM-DD=, !=, >, <, <=AND, OR
ownerNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
policyNumberString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
producerNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
stampDateYYYY-MM-DD=, !=, >, <, >=, <=AND, OR
underwriterNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId1String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId2String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId3String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId4String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userText1String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userText2String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR

Aggregate Portfolios

PropertyData TypeComparisonListLogical
almPerilString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
cedantIdString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
cedantNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
createDateYYYY-MM-DD=, !=, >, <, <=AND, OR
currencyString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
idNumber=, !=, >, <, <=IN, NOT INAND, OR
nameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
numberString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
ownerNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
sourceString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR

Portfolios

PropertyData TypeComparisonListLogical
idNumber=, !=, >, <, <=IN, NOT INAND, OR
numberString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
nameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
descriptionString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
createDateYYYY-MM-DD=, !=, >, <, <=AND, OR
geocodeVersionString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
hazardVersionString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
ownerNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR

Treaties

PropertyData TypeComparisonListLogical
aggregateDeductibleNumber=, !=, >, <, <=IN, NOT INAND, OR
aggregateLimitNumber=, !=, >, <, <=IN, NOT INAND, OR
attachBasisString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
attachLevelString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
attachPtNumber=, !=, >, <, <=IN, NOT INAND, OR
cedantIdString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
currencyString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
descriptionString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
effectDateYYYY-MM-DD=, !=, >, <, <=AND, OR
expireDateYYYY-MM-DD=, !=, >, <, <=AND, OR
isValidBoolean=, !=AND, OR
maolAmountNumber=, !=, >, <, <=IN, NOT INAND, OR
numOfReinstNumber=, !=, >, <, <=IN, NOT INAND, OR
occurLimitNumber=, !=, >, <, <=IN, NOT INAND, OR
pcntCoveredNumber=, !=, >, <, <=IN, NOT INAND, OR
pcntPlacedNumber=, !=, >, <, <=IN, NOT INAND, OR
pcntRetentNumber=, !=, >, <, <=IN, NOT INAND, OR
pcntRiShareNumber=, !=, >, <, <=IN, NOT INAND, OR
premiumNumber=, !=, >, <, <=IN, NOT INAND, OR
priortyNumber=, !=, >, <, <=IN, NOT INAND, OR
producerIdString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
reinstChargeNumber=, !=, >, <, <=IN, NOT INAND, OR
retentAmtNumber=, !=, >, <, <=IN, NOT INAND, OR
riskLimitNumber=, !=, >, <, <=IN, NOT INAND, OR
treatyIdNumber=, !=, >, <, <=IN, NOT INAND, OR
treatyNameString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
treatyNumberString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
treatyTypeString=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId1String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR
userId2String=, !=, LIKE, NOT LIKEIN, NOT INAND, OR

Pagination

Sort data

The sort query string parameter enables you to specify the attribute on which returned records are sorted and the sort order (ascending or descending) for those records.

Use the = operator to specify the sort column. In the following example, the returned records are sorted in ascending order based on the attribute value in the number column.

GET /portfolios?datasource=ds1&limit=3&sort=number ASC&q=number LIKE "Portfolio_*"

By default, Risk Modeler API services returns data sorted by a predefined attribute. If no attribute is specified, the service sorts records in ascending order on the default column.

Records may be sorted in ascending (ASC) or descending (DESC) order.

Page data

The limit and offset query string parameters enable you to paginate data returned from a service.

These two query string parameters are always used together. The size of a page will affect the size of the offset. Where the limit query string parameter specifies the number of records returned per page, the offset query string parameter specifies the number of pages that are "off set" before records are returned.

The following request returns records from the ds1 data source, filtered for the year 2018, listed in ascending order, showing 25 records a page starting with page 1:

GET /portfolios?datasource=ds1&q=year=2018&sort=year=ASC&limit=25&offset=1

The default limit setting is 100 records per page. The default offset setting is 0 pages.