JSON2Video API offers a variety of export options to choose from, including publishing to FTP or SFTP servers. This means that you can easily automate the upload your videos to their final destination without checking continously the render status.

In addition to these export options, the API also allows you to define a call a webhook once the export process has finished. This feature can be incredibly useful for tracking the progress of your video exports or triggering additional actions once the export is complete.

exports property

The exports property of the movie object is an array used to configure the export process, with the following options:

{
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [],
    "exports": [{
        "destinations": [{
            "id": "my-ftp-server",
        }]
    }]
}

Currently, the exports array only supports one item, but the destinations array can be used to specify multiple destinations.

destinations property

The destinations property of the exports object is an array used to configure the different destinations of the export process. You can specify multiple destinations for example to publish to more than one SFTP server.

Each destination item is an object with different properties depending on the type of destination. Destination items are executed in the order they are specified in the destinations array, therefore the first destination item in the destinations array will be executed first, the second item will be executed after the first one finishes, etc.

The following types of destinations are currently supported:

SFTP and FTP destinations

FTP and SFTP destinations require providing the following properties:

And optionally:

The remote-path and the file properties can include dynamic macros that are evaluated at runtime. The available macros are:

Example

Here is an example of a FTP destination:

{
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [],
    "exports": [{
        "destinations": [{
            "type": "ftp",
            "host": "ftp.dlptest.com",
            "port": 21,
            "username": "dlpuser",
            "password": "rNrKYTX9g7z3RgJRmxWuGHbeu",
            "remote-path": "./videos/__yyyy__/__mm__/",
            "file": "__random__.mp4"
        }]
    }]
}

For secutity reasons, it's not a good idea to include all the FTP or SFTP details and credentials in every call to the API, as they can be accidentally exposed. A solution to this is to use the Connections in the dashboard to store all or part of the destination details backend side and refer to it by an id.

dashboard-exports

The id is used to refer to the connection in the Connections section of the dashboard. In the example above, the id is test-ftp and the JSON would look like this:

{
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [],
    "exports": [{
        "destinations": [{
            "id": "test-ftp"
        }]
    }]
}

If needed, any of the properties (with the exception of type) can be overwritten real-time in the destination object, for example:

{
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [],
    "exports": [{
        "destinations": [{
            "id": "test-ftp",
            "file": "__hh__-__nn__-__random__.mp4"
        }]
    }]
}