Using the POST API, you can specify what you would like the spreadsheet generated from reconciliation results to contain and how the data should be arranged. This is specified by parameters in JSON format which is described below.
How to invoke the API
Use any REST API client to send a POST request to the following URL:
Generic reconciliation processes:
{your Duco environment URL}/api/processes/{process_code}/runs/{run_id}/xlsx_results
Cash processes:
{your Duco environment URL}/api/cash/{process_code}/xlsx_results
Refer to our API documentation for standard parameters you need to pass as headers such as a valid API token.
Similar to the GET API, your initial call usually returns a 202 status, which signals a successful request to generate the spreadsheet. Subsequent calls may return 202 when generation is still in progress, or 200 when the file is available and can be downloaded as a file with MIME type application/zip.
View configuration parameters
Different from the GET API, you can pass a JSON parameter to specify what data you want to include in the spreadsheet and how they should be arranged.
Simple example:
{
"view_config": {
"columns": [{
"columnId": "public_id"
}, {
"columnId": "status"
}, {
"columnId": "field_0",
"type": "date"
}, {
"columnId": "field_1",
"type": "string"
}, {
"columnId": "field_2",
"type": "string"
}, {
"columnId": "field_3",
"filters": {
"filter": {
"exclude": ["d78f6e4ddd0354c419834bdecd6239f76df298df", "GBP"]
}
},
"type": "string"
}, {
"columnId": "field_4",
"type": "decimal_number"
}, {
"columnId": "comments"
}, {
"columnId": "input"
}, {
"columnId": "labels"
}],
"bucket": "all"
}
}
The above simple example specifies that:
- Data scope:
- All items (i.e. regardless of workflow or match status), filter by “field_3” (Currency) excluding items with no currency or GBP.
- Column settings:
- Only columns in the list will be included, and in that order.
Acceptable values
In param view_config :
Param |
Description |
bucket |
Correspond to the left hand side menu options in the app, each corresponds to a subset of the result data. Available options: Generic reconciliation process:
Cash process:
|
columns |
List of columns in the order to be exported and filters to be applied. This is optional - if not provided, all columns will be exported in the default order. columnId: The name or Id of the column type: The data type of the column, not needed for system columns filters: Filter criteria for the items. Multiple options are available, see below for more details. Filters can be set depending on the data type. Here are the options with examples:
Filter by values Use include or exclude, with actual values. E.g. "filter": { The long value is specifically for empty value. The above will exclude items with no value or value is GBP.
You can use this for filtering boolean values using “true” or “false".
Filter by text Contains or does not contain a certain text. E.g. "textFilter": { Set excludeMode to false for contain, and to true for does not contain. The example above filters for items which does not contain the text “some value”.
Filter by age Only applicable to the exception age system column. Filter by exceptions where age is older than (olderThan) or newer than (newerThan) certain number of days. E.g. "ageFilter": { The above example filters exceptions where age is 3 days or younger.
Filter by break field Filter for the partially-match items which break on this field, or do not break on this field. "breakFilter": { The above example filters items which break on this field. Set “whereBreakIs” to false for items that do not break on this field.
Filter for roll ups To filter by items with or without roll ups. “boolFilter”: { Active is mandatory. The above example filters by items with roll ups. If you want to filter by items with no roll ups, then set value to “false”.
Numeric value filter You can either use condition (less than “lt”, greater than “gt”, less than or equal “le”, greater than or equal “ge”, equal “eq”, not equal “ne”) or range (“is-between” or “is-not-between”)
"amountFilter": {
The first example above is filtering by items which is less than 0. The second example is filtering by items where the value is between 0 and 10,000 inclusive.
Date value filter The date filter can be used on any column of date type. You can use it to filter by before or after a certain date, between or not between a date range, or on a specific date. All dates need to be given in ISO 8601 format i.e. yyyy-MM-dd, such as 2020-10-19. "dateFilter": { The 3 examples above will filter the data by items with the date field value: 1. after 19th Oct 2020 2. between 9th Oct 2020 and 19th Oct 2020, inclusive 3. equal to 19th Oct 2020 |
Note for cash export
Data included in a cash process export contains the recent data. See here for details.
Expert tips
How to find out column name / number
User defined fields (i.e. match fields, calculated results) are identified by an integer in the view configuration e.g. field_13. This is based on the order that they are displayed in the default view, according to how you configure the reported fields.
However it can be complicated when you reorder the reported fields. The easiest way to find out the field names is to follow the request triggered by the app UI, see below for how to.
Columns from Duco app (e.g. ID, Workflow status, Age) always use their names.
Learn from the UI
A quicker way to come up with the view configuration parameter is to reproduce your export through the UI, and intercept the request parameters from your browser developer tool.
- In the result screen, configure the columns and filters in the way you want your export to look like.
- Launch the browser developer tool:
- For Chrome: see here
- Back in Duco app, click Download > Current view as Excel
- In the Developer tool Console tab, fine the request “spreadsheet-reports”. Go to the Headers tab, and look for the request payload at the bottom.
The request payload there is the Json parameters that you can reuse in your API call.