...
Report templates hold all configurable information that reports can have. This includes the report title, instructions, logos, included project fields, and sort orders. In order to know which template_id to use, you may need to query all reports and choose which template to use from the list of results. To do so, you should first make a GET request to /resources/reports/templates.
You should see something similar to the following result:
Code Block |
---|
{ "success": true, "message": "3 record(s) found", "data": [ { "options": { "sort": [ "groupName", "reviewType", "reviewerName" ], "includedProjectFields": [ "projectNumber", "address", "projectName", "dueDate", "startDate", "notes", "scopeOfWork", "dates" ] }, "id": 2, "jsReport_id": "H1ls_En1OH", "name": "Irvine Report Template", "title": "EPR Corrections Report", "logo": "https://epr-qa.s3-us-west-2.amazonaws.com/reportLogo/1570148452674Orange.jpg", "instructions": "Example Instructions", "createdAt": "2019-10-08T21:07:30.000Z", "updatedAt": "2019-11-13T16:42:16.000Z" }, ...] } |
...
Info |
---|
Suppose the sort option for a template was ['category', ‘subCategory’, ‘reviewerName’]. In this case comments would be grouped by their category. For example, their could be a list of comments grouped under the Civil , and another group of comments grouped under Structural category. Within each of these categories the comments will be ordered alphabetically according to their subCategory. In the case that two comments within the same list have the same subcategory, the comments will comment with an earlier reviewerName(alphabetically) will be displayed first. |
...
Once you’ve found the id of the template you would like to use you can simply make a POST request to /resources/reports/generate with the following request body (JSON):
Code Block | ||
---|---|---|
| ||
{ "project_id": <project_id>, "template_id": <template_id> } |
Including Closed Comments
Info |
---|
This format for this api has changed. Please refer to the example below. |
You can also provide an optional parameter in the request body to specify whether or not to include closed comments in the report. By default, closed comments are filtered out in the corrections report. You can add this option like so:
Code Block | ||
---|---|---|
| ||
{ "project_id": <project_id>, "template_id": <template_id>, "options": { "comments": { "closedComments": <boolean> } } } // old method // below is the old method of grabbing closed comments. // although it still works, it will be phased out in the future { "project_id": <project_id>, "template_id": <template_id>, "options": { "closedComments": <boolean> } } |
Filtering Comments By Label
Info |
---|
This format for this api has changed. Please refer to the example below. |
There may be times where you have multiple external statuses pointing to an internal status (e.g. Open and Approved w/ Comments both point to the ‘Open’ internal status) and want to filter comments to only show if they have a specific external status.
Beginning with the 2.3.4 Release of EPR, you can add the excludedLabels parameter inside of the ‘options’. This optional parameter will be an array of external status labels that you want to filter the report comments by. If specified, comments whose label matches one of the labels in the array will be excluded from the report. This filter stacks with the ‘closedComments’ option. If the ‘closedComments’ option is set to true
...
and the ‘excludedLabels’ array is specified, the api will first grab all the comments for the project, then filter out those in the excludedLabels.
Code Block | ||
---|---|---|
| ||
{
"project_id": <project_id>,
"template_id": <template_id>,
"options": {
"comments": {
"closedComments": true,
"excludedLabels": ["Open"] // Comments with label 'Open' will be excluded from the report
}
}
}
// old method (will still work but will be phased out in future)
{
...
options: {
"excludedLabels": ["Open"]
}
} |
Include Only Comments With Attachments
The following example will generate a report and filter out any comments that do not have attachments. If you want to also include the links to those attachments for users to download, you can do so using the includeAttachmentLinks options. Note that this options can be used independently of one another.
Code Block |
---|
{
{
"project_id": <project_id>,
"template_id": <template_id>,
"options": {
"comments": {
"withAttachmentsOnly": <boolean> // filter out comments without attachments
"includeAttachmentLinks": <boolean> // include attachment links in the report
}
}
} |
Specifying Report Filename
By default, the corrections report that is generated will be saved to the Project Attachments using the report title as the filename. Users can specify a filename parameter in the options to choose the name of the file that is saved to the attachments.
All reports are saved as .pdf files so please do not include the extension in the parameter.
Code Block |
---|
{
"project_id": <project_id>,
"template_id": <template_id>,
"options": {
"filename": "ChangedFilename" // attachment will be saved as ChangedFilename.pdf
}
} |
3. Finished!
If the report was successfully created you should see something similar to the following:
...
Users should then be able to check the attachments tab for that particular project and download the attachment that was created.
...
...
Additional Report Options
...
Users can also now override sort order and included project fields through the report API like so:
...
projectName
contact
projectType
submittal
occupancy
constructionType
squareFootage
buildingHeight
applicationType
serviceArea
site
...
For additional information please refer to the swagger documentation at <portal>.eplansoftreview.com/api/core/ under Reports.