Get a List of Records Out of Visier

Learn how to perform a list query using the Data Model API and Data Query API.

Introduction

This tutorial will walk you through how to perform a list query that provides you with the records that make up a population.

To demonstrate we'll take you through a hypothetical scenario where we use the Data Model API and Data Query API to answer a business question.

You will learn how to:

  • Call the Data Model API to retrieve available objects
  • Perform a list query

Prerequisites

Before beginning this tutorial, you will need:

Scenario

In the Get Aggregated Data Out of Visier tutorial, we performed an aggregate query that showed the current representation of women managers in our organization. Now that we have this data, we want to get a list of individual manager information to share with our Diversity, Equity & Inclusion Committee.

Steps

Determine what information we want

Before performing our list query, we need to determine what information we want to get from our Visier solution based on our business goal or question. This will help us narrow down which object types we need to retrieve from the data model and what specific IDs we need to gather for our list query.

We've been asked to gather and share the following information about the managers from our aggregate query with the Diversity, Equity & Inclusion Committee:

  • Full name
  • Job name
  • Tenure
  • Age
  • Gender

Because our list query is focused on managers, it will include the same metric ID employeeCount and selection concept ID isManager that we gathered from the data model and used in our aggregate query. However, we need to explore the data model to find additional object information based on the list above.

Knowing that the information we want to retrieve are employee properties, we need to find specific property IDs that match each one.

Request and retrieve employee properties

Let's send a request to retrieve a list of properties.

GET https://{vanity_name}.api.visier.io/v1/data/model/analytic-objects/{analyticObjectId}/properties

In each request in this tutorial we will replace the {vanity_name} with our tenant name jupiter and include the API key and security token as a header.

To retrieve this information our request needs to specify the analytic object we want to retrieve properties for, in this case Employee.

Copy
cURL sample request: Retrieve a list of Employee properties
curl -X GET --url 'https://jupiter.api.visier.io/v1/data/model/analytic-objects/Employee/properties' \
-H 'apikey:12345'
-H 'Cookie:VisierASIDToken=abc123'

The response will return a list of all employee properties which includes the following fields:

Field

Description

id

The unique ID of the property.

displayName

The localized display name of the property.

description

The localized description of the property.

dataType

The data type of the property, such as Categorical, HourDuration, or Ratio.

primitiveDataType

The primitive data type of the property, such as Number, String, or Boolean.

Copy
Sample response: A list of all properties for the Employee analytic object
{
    "properties": [
        {
            "id": "Employee.Age",
            "displayName": "Age",
            "description": "The current age of the employee.",
            "dataType": "YearDuration",
            "primitiveDataType": "Number"
        },
        {
            "id": "Employee.Birth_Date",
            "displayName": "Birth Date",
            "description": "The employee's date of birth.",
            "dataType": "Date",
            "primitiveDataType": "Date"
        },
        {
            "id": "Employee.Full_Name",
            "displayName": "Full Name",
            "description": "The employee's first and last name.",
            "dataType": "String",
            "primitiveDataType": "String"
        },
        {
            "id": "Employee.Gender",
            "displayName": "Gender",
            "description": "The gender that the employee identifies with (e.g., woman, man, non-binary).",
            "dataType": "String",
            "primitiveDataType": "String"
        },
        {
            "id": "Employee.Hourly_Rate",
            "displayName": "Hourly Rate",
            "description": "The dollar value of base pay per hour.",
            "dataType": "Currency",
            "primitiveDataType": "Number"
        },
        {
            "id": "Employee.Job_Name",
            "displayName": "Job Name",
            "description": "The group of jobs involving similar responsibilities and qualifications that the employee’s job belongs to.",
            "dataType": "String",
            "primitiveDataType": "String"
        },
        {
            "id": "Employee.Last_Promotion_Date",
            "displayName": "Last Promotion Date",
            "description": "The most recent date on which the employee received a promotion.",
            "dataType": "Date",
            "primitiveDataType": "Date"
        },
        {
            "id": "Employee.Tenure",
            "displayName": "Tenure",
            "description": "The number of months the employee has been with the organization.",
            "dataType": "MonthDuration",
            "primitiveDataType": "Number"
        }
    ]
}

By looking through the list of properties, we find matching descriptions based on what we are looking for and copy the IDs.

  • Line 4 shows a property ID Employee.Age that will provide us with the employee's age.
  • Line 18 shows a property ID Employee.Full_Name that will provide us with the employee's full name.
  • Line 25 shows a property ID Employee.Gender that will provide us with the employee's gender.
  • Line 39 shows a property ID Employee.Job_Name that will provide us with the employee's job name.
  • Line 53 shows a property ID Employee.Tenure that will provide us with how long the employee has been with the organization.

Form the list query

Now that we've gathered the property IDs from the data model, we can perform a list query to get individual manager records.

We will use the following IDs in the body of our query:

  • Metric ID: employeeCount
  • Selection concept ID: isManager
  • Property IDs:
    • Employee.Age
    • Employee.Full_Name
    • Employee.Gender
    • Employee.Job_Name
    • Employee.Tenure

Our list query will include the following fields:

  • Source defines the source data to query, in our case it will be the employeeCount metric.
  • Columns define the detailed information we want to retrieve. We will add a column for each employee property. For example, we will include the property ID for employeeAge in a column which will return the current age of the employee.
  • Filters will include specific data points within a population, in our case we will include isManager to filter only managers in our list.
  • Time interval specifies the time interval for the data we want to retrieve. Our request will specify the following:
    • intervalPeriodType, this will be set to MONTH.
    • intervalPeriodCount, this will be set to 1 to retrieve values for 1 month.
    • fromDateTime, this will be set to the current date, 2021-01-01.

Keep this is mind when working with the time interval:

  • The default TimeDirection is backwards which means the data in the response will move backwards from the specified fromDateTime.
  • The fromDateTime is exclusive. In the below request, the fromDateTime is set at January 1, 2021 to retrieve values up to and including the last day of December.

Explore the list response

You can define the response as JSON, JSON Lines, and CSV. The default response format is JSON, however since we are performing a list query, let's use the Accept header value text/csv to retrieve the response in an easy to read format.

The response below shows us a list of managers for 1 month up to January 1, 2021. It includes:

  • Full name
  • Job name
  • Tenure
  • Age
  • Gender

Now you know how to navigate the Data Model API in order to find the required information to perform a list query using the Data Query API.

As a result of our query we were able to get a list of detailed manager information to share with our Diversity, Equity & Inclusion Committee.

Resources