Report operation



Introduction

Once you have created a chat, you can take a report at any time.

Note: unlike the rest of "Chat" operations, which are served by the Chat Manager service, the report operations described in this page are served by the Digital Trust facade. Their public base path is different from the one used by the other "Chat" endpoints (see the Getting started page and the corresponding API Catalog links for each service).


Operations

Generate report preview

HTTP Request

POST /api/v1/private/chat/{chatId}/report-preview

With the following information provided as JSON:

{
    "template": "CERTIFICATE_CHAT",
    "languageCode": "es_ES",
    "fromDate": "2024-06-17T14:43:40.000Z",
    "toDate": "2024-06-17T14:50:00.000Z",
    "additionalData": {
        "DOC_PURPOSES": [
            "Example purpose of the document."
        ],
        "DOC_URL": "https://example.com/document/",
        "DOC_QR": ""
    }
}

Request body parameters

Parameter Mandatory Datatype Description
template yes string The name of the template to use, for example "CERTIFICATE_CHAT". Must be uppercase letters, digits and underscores only.
languageCode yes string The locale of the report, for example "es_ES".
fromDate no timestamp The date from which you want the messages. If omitted, the messages are taken from the creation of the chat.
toDate no timestamp The date until which you want the messages. If omitted, all the messages up to now are included.
additionalData no object Some extra data for each template.

As response, you will get an HTML with the preview of the Report.

Generate signed report

To generate the final, signed report of a "Chat".

HTTP Request

POST /api/v1/private/chat/{chatId}/reports

With the following information provided as JSON:

{
    "reportId": "a5b66d02-6b60-4c84-8fb5-886b0274347d",
    "filename": "chat-report.pdf",
    "template": "CERTIFICATE_CHAT",
    "languageCode": "es_ES",
    "fromDate": "2024-06-17T14:43:40.000Z",
    "toDate": "2024-06-17T14:50:00.000Z",
    "additionalData": {
        "DOC_PURPOSES": [
            "Example purpose of the document."
        ],
        "DOC_URL": "https://example.com/document/",
        "DOC_QR": ""
    }
}

Request body parameters

Parameter Mandatory Datatype Description
reportId yes UUID Client-provided identifier of the report. UUID V4. Use it afterwards to download the report (see below).
filename no string The filename to use for the generated document.
template yes string The name of the template to use, for example "CERTIFICATE_CHAT". Must be uppercase letters, digits and underscores only.
languageCode yes string The locale of the report, for example "es_ES".
fromDate no timestamp The date from which you want the messages. If omitted, the messages are taken from the creation of the chat.
toDate no timestamp The date until which you want the messages. If omitted, all the messages up to now are included.
additionalData no object Some extra data for each template.

As response, you will get

202 Accepted
with a Location header pointing to /reports/{reportId}. The signed report is generated asynchronously; use the "Get Report PDF URL" and "Get Report ZIP URL" operations below, with the same reportId, to download it once it is ready.

Other responses: 400 (validation error) and 404 ("Chat" not found).

Get Report PDF URL

To obtain a temporary download URL for the PDF document of a report generated with the previous operation.

HTTP Request

GET /api/v1/private/reports/{reportId}/document

As response, you will get the following JSON object:

{
    "url": "https://example.com/download/chat-report.pdf",
    "expiration": "2024-06-17T15:10:00.000Z"
}

HTTP Response parameters

Parameter Datatype Description
url string The temporary download URL of the PDF document.
expiration timestamp The expiration date and time of the download URL.

Other responses: 404 (report not found, or not yet available) and 406 (the requested document type is not valid for this report).

Get Report ZIP URL

To obtain a temporary download URL for the ZIP package of a report generated with the "Generate signed report" operation. The ZIP package contains the signed PDF report together with its supporting evidences.

HTTP Request

GET /api/v1/private/reports/{reportId}/package

As response, you will get the following JSON object:

{
    "url": "https://example.com/download/chat-report.zip",
    "expiration": "2024-06-17T15:10:00.000Z"
}

HTTP Response parameters

Parameter Datatype Description
url string The temporary download URL of the ZIP package.
expiration timestamp The expiration date and time of the download URL.

Other responses: 404 (report not found, or not yet available) and 406 (the requested package type is not valid for this report).