Add Input Attributes
Last updated
Last updated
Before configuring a rule in Nected, determine the data source that the rule will utilize. Nected offers versatility in data source definition:
Direct Input Attributes: With Nected, you can designate custom attributes tailored to your rule. These act as dynamic values supplied alongside API parameters during rule execution. For example, for a discount rule, you might use parameters like "customer type" and "purchase amount." Such parameters offer on-the-fly adjustments when invoking the rule via an API.
Fetch from your Database via DataSet: If you have an existing database, Nected lets you extract parameters directly from it through a dataset. By choosing a dataset, you can refer to its attributes within your rule conditions. For instance, for a rule assessing discounts from a customer's purchase history, you might use a sales dataset to access attributes such as "customer ID" or "total amount".
Fetch from any internal/external API: Over Nected, you can integrate with any 3rd party API to fetch input attributes & data directly to be used in the Rule. For instance, you can fetch customer's KYC, credit history or purchase data with your vendor, and you want to use those data points as well as in your business logic.
Combination of All: Merging custom input parameters with a dataset as well as API is the optimal method. It harnesses your dataset's structured data, let you combine 3rd party data but then also allows for specific parameter overrides when executing the rule. In the discount rule context, this means leveraging dataset information for general trends, while also accommodating unique discounts or promotions via custom parameters.
The right data source setup empowers your rules to span diverse scenarios, from utilizing historical data to making real-time adjustments based on distinct parameters.
To start with, Navigate to the rule editor and click on "Add Input Attribute".
Should you need attributes absent from your dataset, or if you prefer a dataset-independent rule relying solely on custom attributes, you can define these as per your rule's needs.
Click on “Add Field” button and Enter a meaningful name for your attribute (e.g., myCustomAttribute).
Choose Data type from the available options for your custom input attribute. You can define different types of input parameters for your trigger:
String: For alphanumeric data, such as names or addresses.
Numeric: For numbers. It could be integers or decimals.
Date: For date values without a time component, in the format YYYY/MM/DD
like this: 2024/07/21
DateTime: For date and time values, in the RFC3339
format like this: 2024-08-07T12:46:00+05:30
Boolean: For true/false values.
JSON: To input raw JSON data.
List: To input a list of items, which could be numbers or JSON or any other type.
Additionally, pass the test value and select other options as needed.
Click on Save and Next, if you want to attach the dataset to the rule otherwise, you can click on Save and Close
Nected further offers an efficient approach to attribute definition, eliminating manual data source mapping. You can specify a primary identifier, which Rule uses to automatically retrieve the required data from the database via the dataset. Here's how to define custom input attributes with dataset attributes:
Click on
In the first tab, Input Attributes
click on Add Field
and add a new Property.
Now, go to the 2nd tab, Map with Data Source (Optional)
and from the Select Dataset dropdown select your desired dataset.
Then in the same tab, choose the property name (for instance, applicant_id
) to map with the Primary Key
of the dataset.
Click on "Save & Close" to confirm your changes, else click on "Save and Next" to move to attaching 3rd party APIs attributes in the Rule.
Primary Identifier is only needed if you have attached any dataset directly in the rule.
If you type multiple data fields mapped, then the combo of all would be treated as the primary identifier.
Now, after creating the input attribute from Dataset, you can access the property in your rule editor. Here is how you can access the properties:
Go back to the rule editor
Then click on the Property dropdown to select the input attribute
From the dropdown, just select the property, and you're ready to create your rule using that property.
It involves a series of steps where you establish a custom attribute within a rule. This attribute is then linked to the REST API Connector, allowing you to utilize data from your API in the rule's logic.
Nected also offers an efficient approach to attribute definition, eliminating manual data source mapping. You can simply add a property and map that with a REST API, which Rule uses to automatically retrieve the required data from the database via the dataset.
To fetch REST API and create a new property based on that, you need to first create REST API.
Here's how to define custom input attributes with REST API:
Going back to the Input Attributes page, click on the 3rd tab i.e. Fetch From API (Optional)
, and add a new Property.
From the Rest API dropdown, just select the desired API from the dropdown.
In the configure API tab, you can set the URL path of the API, set a method (Get, Post, Put, Patch, Delete) along with which you can add custom headers and query parameters, to customize your API.
On this tab, you can configure the API, and after configuring just click on Fetch Input Attribute via API
button.
After clicking, cehck the output data of the API in JSON format in the Input Attribute tab.
After that, finally, click on Save & Close
. And then again click on Save and Close
to save the input attribute. And now, it's ready to be used in the Rule logic.
When integrating external APIs using the Fetch From API feature in a rule, Response Caching can also be enabled to optimize performance by retrieving cached responses for previously used inputs.
Access the "Fetch From API" Tab: Open the rule and go to the Fetch From API tab.
Integrate or Edit an API: Choose an API from the dropdown list to integrate or click the Edit button to modify an existing integration.
Open the API Settings: In the API configuration modal, navigate to the Settings tab.
Enable Response Caching: Toggle the Response Caching option on and configure:
Key Parameters: Specify input parameters for which cached data will be used.
Cache Expiry Time: Set the expiry duration (Days, Hours, or Minutes) for the cached responses.
Clear Cache: Clear cache data as needed for staging or production environments.
Now, after creating the input attribute from API, you can access the property in your rule editor. Here is how you can access the properties:
Go back to the rule editor
Then click on the Property dropdown to select the input attribute
From the dropdown, just select the property, and you're ready to create your rule using that property.
It’s advisable to test the setup after setting up the rule to ensure that the custom attribute is correctly fetching and displaying data from the API
Additionally, Refer to the details on the custom JS page to see more details on using Tokens.
List not visible in property Dropdown: Lists are not supported within the response, leading to an absence in the property dropdown. Solution: Restructure the response payload to use supported data types such as strings or objects.
Missing Data in Output: Some expected data is missing from the API response. Solution: Confirm the usage of the correct endpoint and parameters for retrieving the specific information.
REST API Connector Errors: If the REST API connector function is not set up correctly, or if the selected connector is not properly configured, the editor will fail to execute the API call. Solution: Ensure that the REST API has been integrated correctly via the Nected connector.
By following this process, you can define custom input attributes efficiently within Nected, allowing you to focus on your rule's logic and conditions rather than manual data mapping
Just click on the "Add Input Attributes
" Button and select the dataset
that you want to attach to the Rule. Otherwise, Click on “+ Create Data Source” if you want to create a new one and follow the steps mentioned at
Once you choose the API, a new tab will open, where you need to configure the API and test it thoroughly to make sure you get the correct data from the API. You can use tokens (Eg - {{.customInput.customer_id}})
inside URL Path, Headers as well as Query Parameters to make your API dynamic based on custom direct input attributes being passed.