Table of Contents

S3 Storage

Products: FastReport Cloud, FastReport Corporate Server, FastReport Publisher

This article covers how to send a report to S3 storage. Instructions on how to work with tasks are described in the General Information section.

Getting Started

You will need the following tools and capabilities:

  1. Knowledge of using API key in Service solutions.

    This article will skip additional information on authentication and authorization.

  2. curl tool.

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

  3. Active subscription to one of the following products: FastReport Cloud, FastReport Corporate Server, or FastReport Publisher.

  4. Internet access.

  5. Configured and accessible S3 storage.

Note! The points above describe recommended tools.

Note! This guide assumes you have configured S3 storage to accept files from external sources.

Creating a Task

Let's look at creating a template sending task to S3 storage:


// Creating a task

 curl -X 'POST' \
  'https://{host_name}/api/tasks/v1/Tasks' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "$t": "CreateS3UploadTaskVM",
  "name": "S3 sending task",
  "subscriptionId": "23e0134c816935c1e11b3737",

  "accessKey": "{public_access_key}",
  "secretKey": "{secret_access_key}",
  "url": "https://example.com",
  "bucketName": "{bucket_name}",
  "useAws": true,
  "enableSsl": true,
  "region": "us-east-1"
  "inputFile": {
    "entityId": "61e0134c816935c1e11b3787",
    "type": "Template"
  },
  "destinationFolder": "/destination_path/"
}'

// Running task by identifier
curl -X 'POST' \
  'https://{host_name}/api/tasks/v1/Tasks/{task identifier}/run' \
  -H 'accept: */*' \
  -d ''

In the EntityId and SubscriptionId fields, you should enter real object identifiers. Otherwise, the task will be terminated with an error.

Executing Task from Request Body


 curl -X 'POST' \
  'https://{host_name}/api/tasks/v1/Tasks/run' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "$t": "RunS3UploadTaskVM",
  "name": "S3 sending task",
  "subscriptionId": "23e0134c816935c1e11b3737",
  "accessKey": "{public_access_key}",
  "secretKey": "{secret_access_key}",
  "url": "https://example.com",
  "bucketName": "{bucket_name}",
  "useAws": true,
  "enableSsl": true,
  "region": "us-east-1"
  "inputFile": {
    "entityId": "61e0134c816935c1e11b3787",
    "type": "Template"
  },
  "destinationFolder": "/destination_path/"
}'

Note! In this case, sending to S3 will be performed directly by this request and the task will not be saved in the database.

Note! The examples don't have the Authorization header because an authentication model based on cookies is used. For more details about authorization, read the section Authentication and Authorization