Variable Looping in Action Rivers: An Example Use Case
  • 4 Minutes to read
  • Dark
    Light
  • PDF

Variable Looping in Action Rivers: An Example Use Case

  • Dark
    Light
  • PDF

Article summary

Introduction

This document outlines a step-by-step process to collect and analyze Rivers Activity Statistics using variable looping in Action Rivers. The primary objective is to gather data from various River Activities and present the required statistics through a comprehensive dataset.

Prerequisite

Prior to proceeding with this document, please make sure to read the Overview of Variable Looping document first to grasp the fundamental concepts.

Example Use Case

Obtaining Specific Rivers Activity Statistics through API Integration

In this use case, the primary goal is to collect Rivers Activity Statistics using APIs. The process comprises the following steps:

  • Retrieving Data from Activities API: The first step involves accessing the Activities API to gather relevant information. This API provides data on various River Activities.

  • Loading Data into Snowflake: After obtaining the data from the Activities API, the information is loaded into a data warehouse like Snowflake.

  • Populating Data into a Variable: Once the data is in Snowflake, it is then extracted and stored in a variable. This variable will hold the relevant information that will be used later in the process.

  • Creating a GET Call for River Activity Statistics: In this step, a new GET call is made to another API specifically dedicated to River Activity Statistics. The API URL contains a parameter that is crucial for obtaining the desired data.

  • Iterating the Variable in a Loop: The variable populated earlier is now utilized to iterate through a loop. The loop repeatedly makes requests to the River Activity Statistics API, using different values from the variable as the parameter in the API URL.

  • Loading Data into Snowflake: As the loop progresses, data is retrieved from the River Activity Statistics API using the variable's values as parameters. Each set of data obtained in the loop is then loaded into Snowflake, effectively building a comprehensive dataset .

  • Presenting the Results: The ultimate goal of the use case is to present the required data, which has been derived from the looped variable values. With all the data now stored in Snowflake, the relevant data can be derived by analyzing and processing the gathered information.

Use Case Benefits:

  • Efficient Data Analysis: By leveraging API integration and looping in Rivery, you can effectively analyze a vast dataset of activities and extract essential statistics, thereby eliminating the necessity for manual processing.
  • Scalability: The process can easily scale to handle a growing volume of activities, making it suitable for applications with expanding datasets.
  • Customizability: The Action River can be tailored to meet specific requirements, allowing users to define which parameter to focus on and which activity statistics are relevant for their needs.

Variable Looping Configuration Steps

The process will be categorized into 6 primary steps. It is crucial to carefully follow each detail in the provided videos, as there are several subsequent steps that must be executed correctly to ensure everything functions properly.

Step 1: Creating an API Token

Before initiating any API calls, ensure proper authentication and authorization mechanisms are in place to access the required data.

Step 2: Action River - Establishing the API Conncetion

In this step, we access the Activities API to collect relevant information, which offers data about various River Activities.

Within the following video, you will be guided through the process of:

  • Providing API URL
  • Configuring the setup to explicitly retrieve a field from the API response.

Please Note:
To obtain the Account and Environment IDs from the URL, follow the instructions provided below:
image.png

  • For further details regarding API Tokens, please refer to our documentation.

Step 3: Source to Targer River - Pushing Activities API Data to Snowflake

Within the following video, you will be guided through the process of:

  • Obtaining data from the Action River created previously.
  • Loading the obtained information into a data warehouse, such as Snowflake.

Step 4: Action River - Establish the Loop

Set up a loop to iterate over the obtained values from the Activities API response.
Within the loop, construct secondary API calls, using each value as a parameter to fetch the relevant activity statistics.

Within the following video, you will be guided through the process of:

  • Creating a loop to iterate over the obtained values from the Activities API response.
  • Making secondary API calls within the loop, using each value as a parameter to fetch the relevant activity statistics.

Please Note:
To obtain the Account and Environment IDs from the URL, follow the instructions provided below:
image.png

Step 5: Source to Targer River - Loading Cross ID data into Snowflake

Within the following video, you will be guided through the process of:

  • Gathering statistics from the secondary API calls.
  • Storing the obtained statistics in a suitable data structure.

Step 6: Logic River - Trigger All Rivers and Get the Results You Need

This step signifies the conclusion of the entire process, during which all preceding steps are activated. Once this step is finished, you will be able to view the outcomes of the API call and the iterated values in your Snowflake warehouse.

Within the following video, you will be guided through the process of:

  • Utilizing a query to extract information from the Target and store it in a variable.
    The specific query demonstrated in the video is as follows:
select CROSS_ID from {Your Database} where is_deleted=false
  • Using the loop created in an Action River to iterate over the variable that holds all relevant information.


Was this article helpful?

What's Next