Element451Integrations Guide

Exporting Documents

Updated Article

URL#

json
POST https://{{client}}.api.451.io/v2/users/documents/export

Body Schema#

json
{
    "notification_webhook" : "",
    "notification_email" : "",
    "destination" : {
        "connector_guid" : "", 
        "path" : ""
    }, 
    "sources" : [
        {
            "provider" : "", 
            "path" : "", 
            "name" : "", 
            "source_name" : "", 
            "have_cover" : , 
            "filter_model" : , 
            "filters" : [], 
            "transformations" : []
        }
    ], 
    "output_settings" : {
        "combine_pdf" : , 
        "combine_pdf_filename" : "", 
        "output_one_folder_per_user" : , 
        "output_one_folder_per_user_filename" : "", 
        "zip_everything" : , 
        "zip_everything_filename" : ""
    }
}    
  • "notification_webhook" : "url" - (optional) A webook url that can be notified.
  • "notification_email" : "email address” - (optional) An email address that can be notified
  • “destination” : {object} - (required) The existing connector guid and path where the files will be exported.
    • "connector_guid" : "client.connector.451" - The Element451 connector to use to export the document.
    • "path" : "folder1/another_folder" - The path to where the documents should be exported.
  • “sources” : [array] - (required) Define what files you are exporting from Element. See the example values below:
    • "provider" : "Application",
    • "path" : "/client.applications.451/__preview",
    • "name" : "[user:id]_applicationpreviewpdf",
    • "source_name" : "Application",
    • "have_cover" : false,
    • "filter_model" : null,
    • "filters" : [],
    • "transformations" : []
  • “output_settings” : {object} - (required) Details about file format and names of the exported files.
    • combine_pdf" : “boolean” - (required) true/false
    • "combine_pdf_filename" : "string" - (optional) Name of filename.
    • "output_one_folder_per_user" : “boolean” - (required) true/false
    • "output_one_folder_per_user_filename" : "string" - (optional) Name of folders
    • "zip_everything" : “boolean” - (required) true/false
    • "zip_everything_filename" : "string" - (optional) Name of zipped file

Example 1 - Document Export

json
Request:
POST https://{{client}}.{{api}}/v2/users/documents/export

URL parameters:
{{client}}: Assigned client subdomain.
{{api}}: URL of the Element451 API. "api.451.io" for Production API.

Request headers:
Feature: Feature token for that client
Authorization: Bearer API Key
Content-Type: 'application/json'

Request body parameters:
{
    "notification_webhook" : "https://...",
    "notification_email" : johndoe@email.com",
    "destination" : {
        "connector_guid" : "client.connector.451", 
        "path" : "fire/testFolder"
    }, 
    "sources" : [
        {
            "provider" : "Application", 
            "path" : "/client.applications.451/__preview", 
            "name" : "[user:id]_applicationpreviewpdf", 
            "source_name" : "Application", 
            "have_cover" : false, 
            "filter_model" : null, 
            "filters" : [

            ], 
            "transformations" : [

            ]
        }
    ], 
    "output_settings" : {
        "combine_pdf" : false, 
        "combine_pdf_filename" : "", 
        "output_one_folder_per_user" : false, 
        "output_one_folder_per_user_filename" : "", 
        "zip_everything" : false, 
        "zip_everything_filename" : ""
    }
}

Expected Response:
Status 202
{
    "guid" : "client.ie_task.451"
}

Webhook notification:
POST <url>
{
    'guid' : 'client.ie_task.451',
    'name' : 'Export Documents via web',
    'started_at' => '2020-01-28T16:22:37-00:00',
    'finished_at' => '2020-01-28T16:23:37-00:00',
    'run_duration' => '1m 0s',
    'status' => 'done',
    'stats' => {
        "count" : 98, 
        "created" : 95, 
        "updated" : 0, 
        "unchanged" : 0, 
        "failed" : 4, 
        "skipped" : 0, 
        "exported" : 94,
    },
    'error' => ,
    'warnings' => [
        "Cannot export 0/5d4de713039603788989050b9_applicationpreviewpdf. Reason: File missing on server: client/private/files/hd1pHFUwski09MglhbPi/client.files.23536.pdf", 
    ],
    'info' => []
}