Creating a ZIP File from a Document

Usage

Creates a ZIP file archiving the document reports of your choice as HTML files.

The file is created on the server.

Caution
  • You get the ZIP file by calling GET /documents/<documentID>/zips/<zipID>?fileName=<fileName>
  • The ZIP file is deleted after the user session closes.
Request

POST /documents/<documentID>/zips?reportIds=<reportID[,...]>

Where:

  • <reportID[,...]> is the list of the report identifiers to be archived in the ZIP file, separated with a comma.

    This parameter is optional. If not present, all the reports of the document are archived.

Request body: the script that allows the file archiving. See example below.

Response

Response type: application/xml or application/json

The response is a message stating the success or failure of the request.

Example

POST /documents/14695/zips?reportIds=1,3

Request body:

<zipfile>
    <zipentry name="index.html">
        <![CDATA[
            <html>
                <head>
                    <title>Save As HTML (customized)</title>
                    <script language="javascript" src="reports.js"></script>
                </head>
                <body bgcolor="#EEEEEE">
                    <div id='content'></div>
                    <script>
                    var content = document.getElementById('content');
                    content.innerHTML = '';
                    for (var key in reportIds) {
                    var reportLink = "<a href='" + key + "/report.html'>"; reportLink += reportIds[key]['name'];
                    reportLink += '</a>'; reportLink += '<br/>'; content.innerHTML += reportLink; }
                    </script>
                </body>
            </html>
        ]]>
    </zipentry>
    <zipentry name="report.html">
        <![CDATA[
            <html>
                <head></head>
                <body></body>
            </html>
        ]]>
    </zipentry>
</zipfile>

Response:

<success>
    <message>The resource of type "ZipFile" with identifier "0" has been successfully created.</message>
    <id>0</id>
</success>