REST API
Last updated
Last updated
The Nected REST API lets you invoke any internal or 3rd party flows over HTTP calls. You can also create a custom integration to any internal or third-party HTTP-based API. Use this integration to configure your API, supporting different types of API authentication, so your team can trigger REST requests in seconds, as part of the rule outcome.
Integrating your existing REST API server to Nected enables you to perform database operations using REST APIs.
Note: You can add a REST API connector to an action in a rule to modify your database using a REST API call.
Follow this procedure to create a connector for your REST API server:
Log into Nected with your Email ID and password.
Click Integrations in the left navigation to open the Integrations page.
Click + Connect under the restAPI header to create a REST API connector. The connection information form for restAPI server information form opens.
Enter the connection information for your REST API server. Note: The REST API server information is the same for both staging and production REST API servers.
Provide the following REST API server connection information:
Connector type – Staging or Production.
Name – Name for the connector. It must be unique throughout the Nected platform and must not contain any spaces.
Base URL – URL of the REST API Server.
Authentication – Select one of the authentication configuration options that you created on the Credentials page.
Preset Headers – Key name and value of the preset headers.
Preset Query Params – Key name and value of the preset query parameters.
Expand to see the IP addresses to add to your allow-list – Nected service IP address (43.205.43.45) added to the allow-list on your REST API server.
Test Connection – Test the connection to your REST API server using the information you provided in the connector.
Publish in Staging – After a successful connection to the server, publish the connector. In this example, the server type is staging, and it will provide the Publish in Staging option. For a production server, the option will be Publish in Production.
Close the connection information form and check the connector status. For Staging server type, it will be staging and for Production server type, it will be Production.
Note: If using Nected cloud, Nected IP address (43.205.43.45) must be added to the allow-list on your database server to secure your connections. Not required in on-premise setup
You need to publish staging and production connectors in their respective environments. If a connector is published only in staging, then it cannot be used in the production environment, and any call to rule in production env will fail giving "connector not published in production" error
If you have a REST API server, then you can use a REST API action in a rule to update your source database.
Note: All production rules must be run securely using an API, but you can choose to run a staging rule either using an API or directly on the Nected platform.
Follow this procedure to add REST API action in a rule:
Log into Nected with your Email ID and password.
Click Rules in the left navigation to open the Rules page.
Click + Create Rule button on the Rules page and select SimpleRule or DecisionTable. The rule configuration form opens. Define the condition and configuration for your rule.
Click Add Action and select the REST API connector for your database. The action REST API configuration form opens.
Provide the following information for the REST API action:The following list describes the options on the REST API action window:
URL Path – The base URL for the REST API.
Method – The REST API method, which can be GET, POST, PUT, PATCH, or DELETE.
Headers – The authentication header retrieved from the REST API connector. You can add more headers using the Add Headers option. You can also add query parameters using the Add Query Parametersoption.
Content Type – The type of the content that you want to update, which can be HTML, Text, JavaScript, JSON, XML, FORM, or FORM URL encoded.
The REST API data or body, which contains the information that you want to insert or update in your database.
Save – Save the REST API action information.
Click on Test in Staging. Then give the inputs and if the result in which the action belongs, is satisfied, the action will trigger and so the API. If the API call is successfully made, then you will see a Success message on the Action tab.
In the Action tab, you can check the status of the API (success or error). And if you click on the dropdown button, you can actually check the JSON output of that API call.
When working with API calls in your rule actions, it's important to be aware of potential errors that may arise during the process. While API calls are primarily HTTP-based, the main categories of errors you might encounter are HTTP status codes, particularly those in the 500 series. However, it's essential to note that Nected does not display the 404 error ("{"error":"Endpoint not found"}") even during API integration.
Here are some common errors you may face and how to address them:
HTTP 500 Series Errors:
What to Expect: These errors indicate that the server has encountered an issue while processing the API request. They can be caused by various factors, such as server misconfigurations or issues on the API provider's end.
How to Resolve:
Check API Endpoint: Ensure that the API endpoint you are calling is correct and accessible.
Verify Request Data: Double-check the data you are sending in your API request. Ensure it adheres to the API provider's requirements.
Contact API Provider: If the issue persists, reach out to the API provider's support for assistance or information on the specific error.
HTTP 404 Error:
Important Note: Nected does not display this error in the API integration stage, but it is essential to be aware of it.
What to Expect: The 404 error typically indicates that the API endpoint could not be found. If you encounter this error, it's likely a result of an issue on your end.
How to Resolve:
Check API Endpoint: Verify that the API endpoint is accurate and exists.
Review Configuration: Review your rule action's configuration to ensure you are calling the correct endpoint and passing the necessary data.
Monitor Output: After including the API as a rule action, make it a habit to monitor the JSON output in the action tab. This will help you identify any 404 errors.
HTTP 403 Error:
What to Expect: An HTTP 403 error signifies that your request has been denied access. This can occur due to various reasons, such as inadequate permissions or IP blocking.
How to Resolve:
Whitelist Nected's IP: If you receive a 403 error, it may be necessary to whitelist Nected's IP address, which is "43.205.43.45". This ensures that Nected can access and interact with the API without any access restrictions.
It's essential to understand that while Nected provides tools for integrating APIs and configuring rule actions, certain errors may be outside of Nected's control, particularly those related to the API provider's infrastructure or your rule action's setup. Regularly monitoring the JSON output and staying vigilant about your API calls will help you quickly identify and address any potential issues. If problems persist, don't hesitate to reach out to the API provider's support for assistance and guidance.