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
  • Context
  • Step by step
  1. Data
  2. How to

Use case: API Gateway trigger parameters

PreviousURL Parameters in API GatewayNextUse case: Exception Handler in financial transactions

Last updated 2 months ago

Context

An e-commerce company needs to ensure that its inventory is always up to date, especially during high-demand periods, such as promotions or holidays. Each time a product is sold, it's vital that the inventory reduction is processed quickly and accurately, preventing customers from becoming frustrated upon discovering that an item is out of stock after purchase.

Imagine that when an item is removed from inventory, it is necessary to provide two pieces of information: the product ID and the quantity subtracted from the inventory. Additionally, it may be necessary to provide a discount applied to the sale.

In this documentation, we will explore how to use path parameters and query parameters in the API Gateway to pass this information.

Step by step

After contextualizing our case, it's time to set up our flow.

The first step is to add an API Gateway Trigger and configure it.

Note that the route follows this format:

                               /product/:id

The colon followed by 'ID' indicates that this is a path parameter. The platform automatically recognizes the ID in the "Parameters" tab, allowing you to add a value to test the operation.

Next, we will add the quantity and discount parameters.

Sending values with commas via the path is not allowed. If there is a value that includes a comma, it must be sent as a query parameter. Therefore, the parameters quantity and discount will be used to pass the quantity and discount value, respectively, in the "Query" tab.

To complete the "API Gateway Trigger" configuration, click "Save".

Next, we will add the PostgreSQL module, whose operation will be "Register payments".

Finally, we will use the "Return" tool module to illustrate the result, using the following configuration:

After the configuration, we will call the API via an HTTP client. To do this, open the API Gateway trigger and copy the provided URL.

When we look at the URL, we notice that the parameter values are not included. Therefore, we need to add them. Refer to the table below:

Provided URL
Changed URL

https://fake-url/sales/v1/product/:id

https://fake-url/sales/v1/product/23?quantity=2&discount=4

By analyzing the structure, we can see that the :id parameter has been replaced with "23", and the query parameters quantity and discount have been added.

It`s possible to manually execute the flow and the values will be filled in the trigger.

After executing the flow, you can check the logs in the API Gateway to confirm if the parameters were received correctly.

Read also:

URL Parameters in API Gateway
API Gateway Trigger configuration screen
Note that in yellow is the route parameter (:id) and in green are the query parameters (quantity and discount)