Skyone
Skyone
English
English
  • Home
  • Data
    • Getting Started
      • Create an account
      • Recover Password
      • Quick Platform Guide
      • How to test the platform for free
      • Workspace
        • Creating a new Workspace
        • Find a Workspace
        • Sending an invitation to a Workspace
        • Editing a Workspace
      • Organizations
        • Creating an Organization
        • Organization Overview
        • Organization Management
        • Organization Monitoring
      • Settings and Preferences
        • Profile
        • Notifications
        • Usage and Billing
        • Users and Permissions
    • Modules
      • Module management
        • Creating a Module
        • Importing a Module
          • IAC Files - Integration as Code
        • Editing a module
        • Module Options
      • Settings and Operations
        • Module settings
          • Connectivity: Database
          • Connectivity: Email
          • Connectivity: REST
          • Connectivity: SOAP
          • Connectivity: File
          • Connectivity: RFC
          • Connected Account Management
        • Operations
          • Importing operations into REST Modules
          • Operation Management
        • Flows Using This Module
    • Monitoring
    • API Gateway
    • Terminals & Agent
      • Agent
        • Versions supported by Agent
        • How to Update the Agent Version
        • How to back up Agent files
      • Terminals
    • Data
      • Data Stack
        • Process Control
        • Data Stack Upload
        • File Actions
        • File Jobs
        • Data Job Parameters
        • Data Store
        • Data Share Features
        • ODBC
        • How to use the Data Engine Proxy
    • Integrations
      • Integration Management
        • Create integration
        • Import Integration
        • Edit Integration
        • Integration Options
        • Flows of this integration
      • Flows
        • Flow management
          • Creating a flow
          • Flow options
          • Flow Canva: configuring and editing the flow
            • Flow Canva: overview
            • Exception Handler
              • Exception Handler - Configuration
              • Exception Handler - Cases
            • Multicontext Flows
              • Example: Multicontext with an API Gateway
              • Example: Multicontext with a Time Trigger
            • Flow Settings
        • Triggers of a flow
          • API Gateway Triggers: Adding and Setting
          • AS2 Triggers: Adding and Setting
          • Queue Triggers: Adding and Setting
          • Flow Triggers: Adding and Setting
          • Time Triggers: Adding and Setting
          • Webhook Triggers: Adding and Setting
        • Tool Modules
          • AS2 Module
          • CSV Module
          • Data Transform Module
          • Data Balancer Module
          • EDI Module
          • Flow Call Module
          • IF Module
          • JavaScript Module
          • Log Module
          • Loop Do While Module
          • Loop For Module
          • Return Module
          • XML Module
          • Other Tool Modules
        • Module Header
        • Connecting components of a flow
        • Editing triggers and modules
        • Data Operations
          • Object Handling
            • Practical example: Handling variables
          • SMOP (Small Operations)
          • Parameterization rules
    • How to
      • Insert JSON into databases
      • Flattening: Data transformation using JSONata
      • How to use Form Data
      • Understanding recursion in JSONata
      • REST Module Output Consolidation
      • Isolated in execution: concept and application in variables
      • URL Parameters in API Gateway
      • Use case: API Gateway trigger parameters
      • Use case: Exception Handler in financial transactions
      • Use case: using Groups to manage access to flows
      • How to create a download endpoint and integrate with Power BI
      • Is it possible to use two triggers in a single flow?
      • How to set up WhatsApp in Skyone Studio
    • FAQ
    • GIGS: The complete guide
    • Glossary
  • Support
    • How do I request support?
    • Case Severity Levels
    • SLAs
    • Help & Resources
Powered by GitBook
On this page
  1. Data
  2. Integrations
  3. Flows
  4. Flow management
  5. Flow Canva: configuring and editing the flow
  6. Multicontext Flows

Example: Multicontext with an API Gateway

PreviousMulticontext FlowsNextExample: Multicontext with a Time Trigger

Last updated 6 months ago

This example shows how a multi-context flow can be produced from requests in an API Gateway. Data included in the request is used to inform the contexts.


Flow Definition

Through a REST call set up in Integra's API Gateway, this integration aims to make weather data kept in a Postgres database accessible. The database created by Example Integration: Multicontext with Time Trigger will serve as our starting point.

This integration will initially only be able to access one database for a single user. Then the same integration will be expanded so that multiple users can access it by simply entering their userid. This will be the data we use to identify the context and with this Integra.Sky can access the correct database for each user.


Steps


Step by Step

Step 01: Create the original monocontext flow

This flow is activated by a request through the API Gateway. The Query String of the request must only contain the number of most recent samples that will be retrieved from the database. The response contains the samples as well as some average temperature and humidity data that were calculated by the platform itself.

Call to trigger the flow:

https://myspace.apihml.integrasky.cloud/eZB6Hf/weather/v1/mylocation?n=100

The user database's most recent 100 records are retrieved as a result of this call. Along with these statistics, the average temperature and humidity are also returned.

Step 02: Insert the variable that will define the context

In this case, we will use a piece of information that comes in the API call itself to define what the context will be. To do this, we will change the Query String of the Trigger API to make it ready to accept the userid. This will be the variable used to define the context. Each userid will link to a particular database account.

With this modification, we will use external information to define the context that will be used.

Step 03: Insert the Context Finder

"Context Finder" will use the context set variable (userid) to locate the database account that will be used to retrieve the weather records.

Context Finder should be inserted right after the API trigger so that it can use the information that comes in the trigger call to identify the context.

And we will indicate the userid information, which is inside the query string, as a context identification parameter.

Step 04: Update the Postgres module to use the access accounts according to the Context

Go back into the Postgres module configuration and select the "use context in this component" option.

By default, the platform will use the account that was already set up as the Default account.

Click on "Next". Select the context and run a test of the new configuration. As you had already run this flow in mono-context, the platform will use the original account as the default account.

Step 05: Set up Database access accounts

Each of the contexts should have its own specific account associated with it.

Create the database accounts in Settings → Connected Accounts.

Step 06: Create the contexts

Create a context for each user that will access the system.

Select "Context" from the flow editing page. Add as many contexts as needed, and specify the value of the key associated with each context.

Step 07: Link the accounts with the contexts

For each of the contexts, link the respective Postgres module account.

In Flow Context, edit each of the contexts. Select the Connected Accounts tab and select the respective account.

Step 08: Call the flow with context information

Enter the userid in the API call that calls the flow.

In your API calling software, specify the value of the userid. Use one of the values specified when creating the context.

https://myspace.apihml.integrasky.cloud/eZB6Hf/weather/v1/mylocation?n=10&userid=0002

Notice that you are now provided with two values for the execution of the flow. The value of n specifies the number of samples that will be retrieved and the value of userid specifies the context and therefore which database will be chosen.

You can see that we can identify the correct operation of Context Finder by the execution logs.

[ Step 01 ] Create the original monocontext flow
[ Step 02 ] Insert the variable that will define the context
[ Step 03 ] Insert the Context Finder
[ Step 04 ] Update the Postgres module to use the access accounts according to the Context
[ Step 05 ] Set up Database access accounts
[ Step 06 ] Create the contexts
[ Step 07 ] Combine the accounts with the contexts
[ Step 08 ] Call the flow with context information
userid as part of Query
Context Finder insertion
userid as key for Context Finder
Reconfiguration to use accounts according to context
Executing a default account