Skip to content

Latest commit

 

History

History
91 lines (78 loc) · 2.15 KB

api.adoc

File metadata and controls

91 lines (78 loc) · 2.15 KB

Report Template

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"
    }
  }
}

Report Request

{
  "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 Export Request

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"]}}
}

Download File

For data exports, the fileId is the UUID returned by the export request.

GET /file/{fileId}?type=LABEL|DATA_EXPORT