PEGA Data Exploration Data Views API usage

Sandeep Pamidamarri
4 min readDec 4, 2022

In this particular post, let’s understand the PEGA Data Exploration Data Views API usage and its importance. In an organization landscape of applications, there may be scenarios where reference data / SOR is maintained in the PEGA Application. For example, reference data includes — customer, account, contact, state/zip codes, claims, pricing, etc…. Sometimes organizations need to surface/use this reference data in other applications.

Let’s refer to a simple customer sample data set — it has generic customer attributes — first_name, last_name, city, state, etc…. The conventional approach is to expose a REST service via D Page with multiple parameters and various filter conditions. This approach provides limitations in maintenance and extensibility. But, PEGA Data Exploration API provides the full capability to perform most of the SQL operations to retrieve the data via API.

Using this API — retrieve the data as per the different scenario use cases.

Step 1: Import the data set into the PEGA Application

  • Create all required properties in the data type class
  • Import the provided CSV into the data type

Note: As part of the data type import process, the system creates the different D Pages.

In this example, let’s observe the below highlighted one.

This D Page doesn’t have parameters defined

The corresponding Report definition doesn’t have any filters defined.

But, still using the API we can perform various SQL operations to retrieve the data.

Step 2: Leverage data views API to retrieve the data

Request URI: http://<env>/prweb/api/application/v2/data_views/D_SampleCustomersList

Consider the following scenarios

Scenario 1: Retrieve all records present in the data type

Observations:

  • No request body
  • In response — the system retrieves all records and all fields present in the data table

Scenario 2: Retrieve the customers with selected fields and their State in LA

Selected fields: First_name, Last_name, State, Country, CustID, City

Filter condition: State = LA

Request payload sample:

{
"query": {
"distinctResultsOnly": true,
"filter": {
"filterConditions": {
"F1": {
"comparator": "EQ",
"ignoreCase": true,
"pyLabel": "string",
"lhs": {
"field": "State"
},
"rhs": {
"value": "LA"
}
}
},
"logic": "F1"
},
"select": [
{
"field": "First_name"
},
{
"field": "Last_name"
},
{
"field": "State"
},
{
"field": "Country"
},
{
"field": "CustID"
},
{
"field": "City"
}
]
}
}

Response:

Scenario 3: Retrieve the customers with selected fields and their State in LA and City in New Orleans

Selected fields: First_name, Last_name, State, Country, CustID, City

Filter condition: State = LA AND City = New Orleans

Request payload sample:

{
"query": {
"distinctResultsOnly": true,
"filter": {
"filterConditions": {
"F1": {
"comparator": "EQ",
"ignoreCase": true,
"pyLabel": "string",
"lhs": {
"field": "State"
},
"rhs": {
"value": "LA"
}
},
"F2": {
"comparator": "EQ",
"ignoreCase": true,
"pyLabel": "string",
"lhs": {
"field": "City"
},
"rhs": {
"value": "New Orleans"
}
}
},
"logic": "F1 AND F2"
},
"select": [
{
"field": "First_name"
},
{
"field": "Last_name"
},
{
"field": "State"
},
{
"field": "Country"
},
{
"field": "CustID"
},
{
"field": "City"
}
]
}
}

Response:

Hurrayyyyyy, congratulations :) Now you successfully understood the PEGA Data Exploration API usage and its importance. Happy Learning :)

--

--

Sandeep Pamidamarri

Digital Transformation Leader | Pega Lead Solution Architect | Pega Certified Data Scientist | Pega Customer Service | Pega Sales Automation | AWS Cloud