Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Note

The following routes are considered legacy and should not be used:

  • /resources/reports/create

  • /resources/reportTemplates

  • /resources/reportTemplates/{id}

  • /resources/reports/pdf

In addition to creating corrections reports through the EPR app, clients and third-party integration companies can also generate reports through our API route. Generating a report through the api only requires two parameters: project_id and template_id. This article will walk you through how to generate the report through the API with the correct parameters.

...

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
languagejson
{
  "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
languagejson
{
  "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
languagejson
{
  "project_id": <project_id>,
  "template_id": <template_id>,
  "options": {
    "comments": {
      "closedComments": true or false,
      "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.

Info

Although available to use, the following feature is still experimental and is not currently recommended

...

Additional Report Options

...

Users can also now override sort order and included project fields through the report API like so:

...