Import

Starting a file upload

Overview

A resumable chunked upload is initiated via a POST request. The request URL indicates where the file should be located once the upload is complete. The request must indicate the total size of the file the server should expect.

The Location header in the response indicates the URL where chunks of the file should be uploaded. Once the server has received all chunks, the import into the workspace is completed. An upload that is not completed in a timely fashion from the initial POST is discarded by the server.

Uploading a file

After initiating the transfer, uploads are performed as many times as required using PUT actions:

A response of 308 indicates that the server has not yet received all required bytes, and the Range response header indicates the bytes known to the server so far. When the server has received all bytes, a 201 Created response is returned, with a Location header specifying the location of the newly added file or directory. The X-Xfer-Options header specifies what the server should do with the file when the upload completes. By default the server assumes the file is an archive and will attempt to extract it into the destination location. When importing a single file, the "raw" option can be used to indicate that the server should simply place the uploaded file at the specified location.

Importing a zip

The chunked file upload service can also be used to import an archive file that will be expanded upon completion of import. This allows a large number of files to be imported into a project at once.

Overview

An upload is initiated via a POST request. The request URL indicates where the file should be located once the upload is complete. The request must indicate the total size of the file the server should expect.

The Location header in the response indicates the URL where chunks of the file should be uploaded. Once the server has received all chunks, the file is unzipped into the destination location on the server. An upload that is not completed in a timely fashion from the initial POST is discarded by the server.

Importing from SFTP

SFTP import is a server to server operation for pulling content from an SFTP server into an Orion workspace.

Overview

An import is initiated via a POST request. The request URL indicates where the file should be located once the upload is complete. The X-Xfer-Options header indicates the type of import, and the request body provides details required to complete the import.

The Location header in the response indicates the URL of a progress resource that can be used to monitor the state of the import operation. By default this import will overwrite any files in your workspace with the same name. An X-Xfer-Options value of "no-overwrite" indicates that the operation MUST fail if the resource to be created already exists. A 412 return code is used to indicate that the "no-overwrite" option was specified and the destination resource already exists. An X-Xfer-Options value of "overwrite-older" will overwrite any files in your workspace with a timestamp older than the file on the source server.

Importing a file via a single POST call

Overview

Although the resumable chunk-based upload approach is recommended for large files, you can also import a file with a single POST call. Simply omit the X-Xfer-Content-Length header, and include the file to be uploaded as the request body.

If the POST method body contains the entire content, then 201 response is returned and the import is complete. If the entire content is not received, then a 308 response is returned along with the range received by the server. The client can then resume or complete the upload via a subsequent PUT operation with appropriate range. The file is only imported into the workspace once the entire content is received.

Import a file from a remote URL

Overview

You can also import a file located at an arbitrary remote URL. This example imports an HTML file from http://example.com/files.html, and imports it into SomeFolder on the Orion server.

The X-Xfer-Options header specifies what the server should do with the file when the upload completes. By default the server assumes the file is an archive and will attempt to extract it into the destination location. When importing a single file, the "raw" option can be used to indicate that the server should simply place the uploaded file at the specified location.

The body of the response will be the exported files/directories in the requested format. If no Content-Type is specified in the request, then the default response type is application/zip.

SFTP export to another server

Importing from SFTP

SFTP import is a server to server operation for pulling content from an SFTP server into an Orion workspace.

Overview

A server to server export is initiated via a POST request. The request URL indicates the file or directory to export. The X-Xfer-Options header indicates the type of export, and the request body provides details required to complete the export.

The Location header in the response indicates the URL of a progress resource that can be used to monitor the state of the export operation. By default this export will overwrite any files in the destination server with the same name. An X-Xfer-Options value of "no-overwrite" indicates that the operation MUST fail if the resource to be exported already exists. A 412 return code is used to indicate that the "no-overwrite" option was specified and the destination resource already exists. An X-Xfer-Options value of "overwrite-older" will overwrite any files in the remote server with a timestamp older than the file in the source workspace.