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. Thedatasource
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 adataSourceName
) 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. Theattribute
value filter is an expression that consists of an attribute, an attribute value, and a comparison operator (=
orLIKE
). You can define complex queries by linking multiple expressions together using logical operators (AND
orOR
). - 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 ofASC
for ascending orDESC
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 LIKE
operators.
- 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. TheLIKE
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. TheNOT 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. TheIN
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. TheIN
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.
Property | Data Type | Comparison | List | Logical |
---|---|---|---|---|
accountid | Number | = , != , > , < , >= , <= | IN , NOT IN | AND , OR |
accountName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
accountNumber | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
branchName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
cedantName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
effectiveDateFrom | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
effectiveDateTo | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
expirationDateTo | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
ownerName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
policyNumber | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
producerName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
stampDate | YYYY-MM-DD | = , != , > , < , >= , <= | AND , OR | |
underwriterName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId1 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId2 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId3 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId4 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userText1 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userText2 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
Aggregate Portfolios
Property | Data Type | Comparison | List | Logical |
---|---|---|---|---|
almPeril | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
cedantId | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
cedantName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
createDate | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
currency | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
id | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
name | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
number | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
ownerName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
source | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
Portfolios
Property | Data Type | Comparison | List | Logical |
---|---|---|---|---|
id | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
number | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
name | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
description | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
createDate | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
geocodeVersion | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
hazardVersion | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
ownerName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
Treaties
Property | Data Type | Comparison | List | Logical |
---|---|---|---|---|
aggregateDeductible | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
aggregateLimit | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
attachBasis | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
attachLevel | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
attachPt | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
cedantId | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
currency | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
description | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
effectDate | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
expireDate | YYYY-MM-DD | = , != , > , < , <= | AND , OR | |
isValid | Boolean | = , != | AND , OR | |
maolAmount | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
numOfReinst | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
occurLimit | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
pcntCovered | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
pcntPlaced | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
pcntRetent | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
pcntRiShare | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
premium | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
priorty | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
producerId | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
reinstCharge | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
retentAmt | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
riskLimit | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
treatyId | Number | = , != , > , < , <= | IN , NOT IN | AND , OR |
treatyName | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
treatyNumber | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
treatyType | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId1 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , OR |
userId2 | String | = , != , LIKE , NOT LIKE | IN , NOT IN | AND , 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.
Updated about 1 year ago