This article describes REST data source configuration and usage in the Table Grid Next Generation.
Info |
---|
The Data source type is REST. We support only JSON for processing data. You can access remote REST API using data sources in the Grid Custom Field. |
REST Data source configuration
Tip |
---|
Try the example REST data source with users' data https://jsonplaceholder.typicode.com/users |
You can add a Data source under the Data Sources tab in the grid configuration dashboard.
Available fields:
Name - a name of your data source connection
...
Style |
---|
dt {
font-weight: bold;
margin-bottom: 2px;
margin-top: 2px;
} |
To connect a REST data source fill in the following fields:
Excerpt | ||
---|---|---|
| ||
Configuration and usage of the REST data source in the Table Grid Next Generation. |
Name
Name of the data source connection.
Description
Optional description of the data source for your reference. It will be displayed below the title in the Data source list.
...
Datasource Type
The type
...
of your data source. You can use REST and SQL data sources.
URL
...
Link to the REST API you want to connect to the grid.
...
Path - the path to JSON array. You can specify it when loading a specific array from the JSON.
Headers - allows adding header fields. You can use them in case the data source requires HTTP authentication.
...
Authorization
Access credentials to the API. If the data source requires HTTP authentication enter a Username and a Password in the corresponding fields.
Headers
Allows adding header fields.
You can test a connection to the data source using a Test by selecting Test Connection button.
...
You can specify the direct path to an array inside the JSON with the help of JSONPath expressions. Data may be found and extracted out of JSON structures.
JSONPath expressions always refer to a JSON structure. A JSON structure is usually anonymous and doesn't have a "root member object". Thus the JSONPath assumes the abstract name $
assigned to the outer level object.
JSONPath expressions can use the dot–notation.
Overview of the JSONPath syntax elements
...
Info |
---|
JSONPath square brackets operate on the object or array addressed by the previous path fragment. Indices always start by 0. |
JSONPath examples
To practice JSONPath expressions with some examples we will start with a simple JSON structure representing a users' data.
Code Block | ||||
---|---|---|---|---|
| ||||
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
},
{
"id": 2,
"name": "Ervin Howell",
"username": "Antonette",
"email": "Shanna@melissa.tv",
"address": {
"street": "Victor Plains",
"suite": "Suite 879",
"city": "Wisokyburgh",
"zipcode": "90566-7771",
"geo": {
"lat": "-43.9509",
"lng": "-34.4618"
}
},
"phone": "010-692-6593 x09125",
"website": "anastasia.net",
"company": {
"name": "Deckow-Crist",
"catchPhrase": "Proactive didactic contingency",
"bs": "synergize scalable supply-chains"
}
} |
...