The REST Data Source Connector allows you to pull data from an external API into a data source and populate its rows/columns for use in screens.
This connector functions similarly to our REST Field (in-app REST requests) that can push or pull data from your API, a custom API, or nomorePAPER's API.
However, getting the data into the correct format generally requires a few changes to its structure before it can be used in the app or our web portal. You can code this yourself or utilize a third-party service (e.g., Zapier, Integromat) to format the data structure.
Now, with the REST Data Source Connector, pulling data from an external API into a data source is much simpler. Data can be pulled from a Target URL, and then an array with objects can be mapped to a data source's rows/columns.
In this article
- Adding a REST Data Source Connector
- Configuring a REST Data Source Connector
- Example JSON expression
- JSON
- Expressions
- Optional Settings
- Headers
- Body
- Add REST Step
Adding a REST Data Source Connector
Data Source Connectors can be added to pull data from other systems in any Data Source Settings area. Navigate the side menu to Connected Data > Data Sources and click on the Settings option of the desired data source.
On the Data Source's Settings, under the Connector area:
- Click the +Add Connector button to bring up a list of connectors.
- Click on the REST option.
Configuring a REST Data Source Connector
Refresh Frequency
The time interval of which data is pulled and refreshed by this connector. Options are 15 Minutes, 30 Minutes, 1 hour, 2 hours, 6 hours, 12 hours or daily.
Using Connection
Allows you to select a REST connection. If the 3rd party endpoints are using oAuth 2.0, this is required as the Authentication and Access Token are retrieved in the REST Connections.
HTTP Action
Defines what kind of REST API procedure you are going to use.
Method | Description |
GET | Use GET requests to retrieve resource representation and not modify it in any way. |
POST | Use POST to create a new row in the source database table. |
PUT | Use PUT primarily to update an existing resource. |
DELETE | As the name applies, DELETE is used to delete resources. |
PATCH | PATCH requests are to make a partial update on a resource. |
Data As - specify the format of the Rest API is.
- JSON - JavaScript Object Notation format
- XML - eXtensible Markup Language format
Target URL
Specify where the request URL and the data will be retrieved/updated.
Use Global Datasource REST URL
The system will use connector requests to the REST endpoint defined in Organization Setup -> Global Datasource REST URL.
Path Row Selector
Specify which resources to affect. Expressions depend on the value in the 'Data As' field.
The below tables are step-by-step expression comparisons between JSON and XML syntax.
JSON | XML | Description |
---|---|---|
$ | / | the root object/element |
@ | . | the current object/element |
. or [] | / | child operator |
n/a | .. | parent operator |
.. | // | recursive descent |
* | * | Wildcard. All objects/elements regardless of their names. |
n/a | @ | Attribute access. JSON structures don't have attributes. |
[] | [] | Subscript operator. XPath uses it to iterate over element collections and for predicates. |
[,] | | | Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set. |
[start:end:step] | n/a | array slice operator |
?() | [] | Applies a filter (script) expression. |
() | n/a | script expression, using the underlying script engine. |
n/a | () | groupings |
Response Mapping
Map the columns from the Data Source to the response values. Depending on the business requirement, you can define all fields or only select fields from your JSON/XML.
Path to Column Value - specify the source column you are retrieving/updating. The value of this must be the same name as that defined in JSON/XML.
Column Name - specify the data's destination column.
Example JSON expression
JSON
An example of an array with objects that contain data to populate a data source.
Expressions
Below are the sample expressions to get a particular data set from the JSON.
Optional Settings
Headers
This defines an option to attach custom HTTP headers in your request to the external platform. This is useful if the external system requires you to authenticate using AUTH headers containing your username and password.
Click the Headers option on the connector to display Key and Value properties.
Key
Specify the name of the header key.
Value
This is the header 'key' value that will be sent to the external system as part of the header request.
Note: You can add multiple headers in one request.
Body
Customize the Body on a single or a second-step request.
Add REST Step
This allows you to have two requests in a single REST API. The first step can be from a different URL, and the result of the first request can be passed to the second request.
Click the Add REST Step option to create Step 1 and Step 2 to be configured.
HTTP Action
Defines what kind of REST API procedure you are going to use.
Method | Description |
GET | Use GET requests to retrieve resource representation and not modify it in any way. |
POST | Use POST to create a new row in the source database table. |
PUT | Use PUT primarily to update an existing resource. |
DELETE | As the name applies, DELETE is used to delete resources. |
PATCH | PATCH requests are to make a partial update on a resource. |
Data As - specify the format of the Rest API.
- JSON - JavaScript Object Notation format
- XML - eXtensible Markup Language format
Target URL
Specify where the request URL and the data will be retrieved/updated.
The added REST step is triggered first, allowing for retrieved data to be used in the request.
The result from the REST step returned as $response for use in the subsequent request below.
Access properties or lists of elements from JSON responses via the JSONVAL() and JSONLIST() formula functions.
Similarly, for XML responses, use XMLVAL() and XMLLIST().
e.g. {(JSONVAL($response, 'path.to.property'))}