Map the results to a tabular format
The Output Module supports a tabular output format and uses a different kind of ViewConfig, called TableViewConfig. TableViewConfig has a Columns mapping section that assigns each selected field to a column. The previous examples use the ViewConfig as input to the API to produce a JSON tree format.
The following example uses TableViewConfig. This is available under the same {{domain}}/rest/2.0/outputModule/export/json endpoint, just using the TableViewConfig as the JSON payload.
{
"TableViewConfig": {
"displayLength": 5,
"displayStart": 10,
"Resources": {
"Community": {
"Id": { "name": "communityId" },
"Name": { "name": "communityName" },
"Description": { "name": "communityDescription" }
}
},
"Columns": [
{ "Column": { "fieldName": "communityId" } },
{ "Column": { "fieldName": "communityName" } },
{ "Column": { "fieldName": "communityDescription" } }
]
}
}---
TableViewConfig:
displayLength: 5
displayStart: 10
Resources:
Community:
Id:
name: "communityId"
Name:
name: "communityName"
Description:
name: "communityDescription"
Columns:
-
Column:
fieldName: "communityId"
-
Column:
fieldName: "communityName"
-
Column:
fieldName: "communityDescription"When formatted, this query produces an array of rows, each containing the requested columns.
In the following example, the "displayLength" value is set to 0. This query shows the number of entities without retrieving actual results.
You can use the TableViewConfig queries with the following endpoints:
{{domain}}/rest/2.0/outputModule/export/{{json | csv}}{{domain}}/rest/2.0/outputModule/export/{{json | csv | excel}}-file{{domain}}/rest/2.0/outputModule/export/{{json | csv | excel}}-job
Last updated
Was this helpful?