Add Input Attributes

Before configuring a rule in Nected, determine the data source that the rule will utilize. Nected offers versatility in data source definition:

  1. 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.

  2. 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".

  3. 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.

  4. 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".

Direct Input Attributes to Rule Input

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 DD/MM/YYYY.

    • DateTime: For date and time values, in the format DD/MM/YYYY HH:MM.

    • 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

Attaching DataSet Params to Rule Input:

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:

  1. 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.

  2. 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:

  1. Go back to the rule editor

  2. Then click on the Property dropdown to select the input attribute

  3. From the dropdown, just select the property, and you're ready to create your rule using that property.

Fetching REST API as Custom Input

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:

  1. Going back to the Input Attributes page, click on the 3rd tab i.e. Fetch From API (Optional), and add a new Property.

  2. From the Rest API dropdown, just select the desired API from the dropdown.

  3. 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.

    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.

  4. On this tab, you can configure the API, and after configuring just click on Fetch Input Attribute via API button.

  5. After clicking, cehck the output data of the API in JSON format in the Input Attribute tab.

  6. After that, finally, click on Save & Close. And then again click on Save and Close to save the input attribute. And now, its ready to be used in the Rule logic.

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:

  1. Go back to the rule editor

  2. Then click on the Property dropdown to select the input attribute

  3. 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.

Error Handling and Troubleshooting

  1. 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.

  2. 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.

  3. 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

Last updated