The file represented by templateFilename
must exist in the template folder of the dina-export-api
.
{
"data": {
"type": "report-template",
"attributes": {
"group": "aafc",
"templateOutputMediaType": "text/html",
"outputMediaType": "application/pdf",
"includesBarcode": true,
"name": "demo-label",
"templateFilename": "demo.ftlh"
}
}
}
{
"data": {
"type": "report-request",
"attributes": {
"group": "aafc",
"reportTemplateUUID": "08b871ed-52c3-4ef9-be86-a51504499a21",
"payload": {
"elements": [
{
"barcode": {
"id": "my-id",
"content": "ABC-209393"
},
"data": {
"attributes": {
"materialSampleName": "ABC-209393"
}
}
}
]
}
}
}
}
Data Exports are running asynchronously. Upon creation using a POST, an export UUID will be returned. The UUID can
be used to query the state using the same (data-export
) with a GET. An optional columnAliases
attribute can also be submitted
as long as the length of the array is the same as columns
. If aliases are only required for some column the others should have an empty string so the real
header name will be used.
POST /data-export
{
"data": {
"type": "data-export",
"attributes": {
"source": "dina_material_sample_index",
"query": "{\"query\": {\"match_all\": {}}, \"sort\": [{\"data.attributes.createdOn\": \"asc\"}]}",
"columns": ["materialSampleName", "collectingEvent.dwcVerbatimLocality"]
}
}
}
Optionally, some functions can be used on columns to create new calculated columns that can then be added to the columns
.
{
"columnFunctions":{"latLong":{"functionName":"CONVERT_COORDINATES_DD","params":["collectingEvent.eventGeom"]}}
}