Search Results for

    Show / Hide Table of Contents

    Save to FTP server

    This article describes how to send a report to an FTP server. Instructions on how to work with tasks are described in the General information section.

    Getting started

    You will need the following tools and facilities:

    1. Know how to use API key in FastReport Corporate Server.

      This article will skip over additional information on authentication and authorization.

    2. Curl tool.

      Any other REST client will work, but the examples will be built for curl.

    3. Active FastReport Corporate Server subscription that has at least two user slots.

    4. Internet access.

    5. Configured and available FTP server.

    Important! The items above describe the recommended tools.

    Important! This guide assumes that you have an FTP server configured to accept files from external sources.

    Create task

    Let’s consider creating a task to send a template to an FTP server:

     curl -X 'POST' \
      '{your_host_name}/api/tasks/v1/Tasks' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "$t": "CreateFTPUploadTaskVM",
      "name": "FTP send task",
      "subscriptionId": "23e0134c816935c1e11b3737",
      "ftpHost": "ftp://localhost",
      "ftpPort": 21,
      "ftpUsername": "FtpUser",
      "ftpPassword": "password",
      "archive": false,
      "archiveName": "Arcvive name",
      "useSFTP": false,
      "inputFile": {
        "entityId": "61e0134c816935c1e11b3787",
        "type": "Template"
      },
      "destinationFolder": "/destination_path/"
    }'
    
    // Start a task by ID 
    curl -X 'POST' \
      '{your_host_name}/api/tasks/v1/Tasks/{task ID}/run' \
      -H 'accept: */*' \
      -d ''
    

    Real object IDs should be written to the EntityId and SubscriptionId fields. Otherwise, the task will be terminated with an error.

    Execute task from the request body

     curl -X 'POST' \
      '{your_host_name}/api/tasks/v1/Tasks/run' \
      -H 'accept: */*' \
      -H 'Content-Type: application/json' \
      -d '{
      "$t": "RunFTPUploadTaskVM",
      "name": "FTP send task",
      "subscriptionId": "23e0134c816935c1e11b3737",
      "ftpHost": "ftp://localhost",
      "ftpPort": 21,
      "ftpUsername": "FtpUser",
      "ftpPassword": "password",
      "archive": false,
      "archiveName": "Archive name",
      "useSFTP": false,
      "inputFile": {
        "entityId": "61e0134c816935c1e11b3787",
        "type": "Template"
      },
      "destinationFolder": "/destination_path/"
    }'
    

    Important! In this case, sending to FTP will be done directly by this request and the task will not be saved in the database.

    Important! There is no Authorization header in the examples because a cookie-based authentication model is used. For more information about authorization, please see Authentication and authorization.

    Back to top 2025.2.6 © 1998-2025 Copyright Fast Reports Inc.