Export Library Documents

Creates a job to export documents from the library. This allows you to automate the tasks of exporting and downloading documents.

The Export Library Document job copies the content of library documents to the default download location, where you can download them to your local computer. The job enables batch exporting of documents using a list of document dientifiers (UUIDs or paths).

You can use the Inbox/Outbox Explorer to view the details of the copied file. Use the Download REST API to download the file.

You can provide multiple document identifiers (UUIDs or paths) in a comma-separated list via the idOrFullyQualifiedName parameter. Depending on the specified exportFormat, documents can be exported individually or collectively in a zipped file to the Inbox/Outbox.

Using this REST API requires prerequisites, such as understanding how to use jobs. See Prerequisites. Be sure that you understand how to use jobs as described in Managing Jobs. For additional details, see Job Types.

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for Cloud EPM REST APIs.

Required Roles

Service Administrator

Request

Supported Media Types: application/json

Parameters

The following table summarizes the client request parameters specific to this job. For additional parameters that are common to all jobs, see Execute a Job.

Table 8-36 Parameters

Name Description Required Default
jobType Copy Artifact From Library, Export Library Document, or COPY_ARTIFACT_FROM_LIBRARY (all values are supported) Yes None
jobName The name of this job. Example: Copy_Quarterly_Sales No Export Library Document
idOrFullyQualifiedName Comma-separated list of document identifiers (UUIDs or paths) being exported Yes None
saveAsFile

The output file name, in the default download location, to which the document should be copied.

If a file with the same name exists, the job will error out unless the overwrite flag is passed as true. See the usage guidelines for important considerations.

No None
overwrite If a file with the same name exists in the default download location, the file will not be overwritten by default unless the overwrite flag is passed as true. See the usage guidelines for important considerations. No false
errorFile

The error file name, in the default download location, which contains the details (including errors) of the operation. Any existing error file with the same name is overwritten.

If you don’t provide the extension in errorFile, the file will use .log as the default extension.

Use the Inbox/Outbox Explorer to view the details of the error file. Use the Download REST API to download the file.

No false
exportFormat

The format of the copied document. Allowed values are file and zip.

  • file - copies the document in its original binary format. For example, if the document is a PDF or Microsoft Word document, it is copied as a PDF or a Microsoft Word document.

  • zip - copies the document in its original binary format and zips it.

No file

For a sample URL, see Sample URL and Payload in Execute a Job.

Sample Payload Example: Exporting one document to a ZIP file

Copies a document called WeeklySales.txt, identified with the complete path of the document, to the default download location and compresses it. The output file name will be WeeklySales.zip. If a file with the same name exists in the Inbox/Outbox, the existing file will be overwritten. An error file with the name WeeklySalesErrorLog.log will be created with the details of the activity.

{
    "jobType": "COPY_ARTIFACT_FROM_LIBRARY",
    "jobName": "Copy Invalid SKU Q1 List",
    "parameters":
        {
                "artifactName": "Library/folder1/WeeklySales.txt",
                "saveAsFile": "WeeklySales.zip",
                "overwrite": "true",
                "errorFile": "WeeklySalesErrorLog.log",
                "exportFormat": "zip"
       }
}

Sample Payload Example: Exporting multiple documents to a ZIP file

Exports a list of documents identified by paths into a ZIP file. The export process generates a log file, BatchExportLog.log, with details and outcomes of all exported documents.

{
    "jobType": "COPY_ARTIFACT_FROM_LIBRARY",
    "jobName": "BatchExportDocuments",
    "parameters": {
        "idOrFullyQualifiedName": "Library/FinancialReport2023.xlsx, Library/FinancialReport2022.xlsx, Library/FinancialReport2021.xlsx",
        "exportFormat": "zip",
        "overwrite": true,
        "saveAsFile": "BatchExport.zip",
        "errorFile": "BatchExportLog.log"
    }
}}

Usage Guidelines

Notes on the overwrite flag

  • The overwrite flag is especially critical when dealing with multiple documents.

  • A single overwrite value applies uniformly across all documents in the batch:
    • If set to true, any existing files matching the exported documents' names will be overwritten without prompt.

    • If set to false, the system will not overwrite existing files and will skip those documents.

Caveats for using the saveAsFile parameter

  • The saveAsFile parameter influences the naming of exported files but has specific behaviors depending on the number of documents and the selected export format.

  • Single Document: If only one document ID is provided, the file will be saved with the name specified in saveAsFile, assuming the file extension matches the document’s format.
  • Multiple Documents:

    • If the exportFormat is set to zip, regardless of the number of documents, saveAsFile determines the name of the resulting ZIP file. Ensure that the .zip extension is used.

    • If exportFormat is not set to zip, the saveAsFile parameter will be ignored, and each document will be exported under its original name.