Level: Beginner
Steps Used:
- JSON Record
- XLSX Writer
- JSON Record
- HTTP Endpoint
Scenario
You wish to provide a quick way for a user to consume data in a download.
Discussion
Many times, we simply want to provide a quick link for users to download an entire dataset or part thereof. While it is possible to create an RML template to show the dataset in a table, if no complex manipulations are required, Ambience 2020 offers HTTP Endpoints as an alternative.
To achieve this, build a chain that looks like this:
Our example uses the following mock data:
[
{
"col1" : "A",
"col2" : "B"
},
{
"col1" : "C",
"col2" : "D"
},
{
"col1" : "E",
"col2" : "F"
}
]
The XLSX Writer will turn this into XLSX bytes:
Choose the column order you want, and ignore any fields you don’t want to see.
The next JSON record adds a filename to the output:
Finally the HTTP Endpoint gives you a URL you can use to access the spreadsheet, which will be downloaded as “MyOutput.xlsx”.