Tutorial: 4. Transfer API

4. Transfer API

The Orion Transfer API is used to import and export packages and files. For more information about the Orion Transfer API, see http://wiki.eclipse.org/Orion/Server_API/Transfer_API.

This page describes the usage of the Orion Transfer API in the context of SAP HANA. Currently, there are some restrictions. For example, although the Orion Transfer API supports the upload of single (binary) files also in the form of multiple chunks, it is not possible to use the Orion API to import (or export) a package. Neither is it possible to import files from (or export files to) an external server.

Contents

Importing Files

Start a File Upload

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

Based on: http://wiki.eclipse.org/Orion/Server_API/Transfer_API#Starting_a_file_upload.

Example Request

POST /sap/hana/xs/dt/base/xfer/import/MyProj/SomeFile.jpg

Orion-Version: 1.0
X-CSRF-Token: "65ABA3082325A3408FBE71C87929102B"
Slug: MyFile.jpg
X-Xfer-Content-Length: 901024
X-Xfer-Options: raw

Example Response

HTTP/1.1 200 OK

Location: /sap/hana/xs/dt/base/xfer/import/fks3kjd7hf
ContentLocation: /xfer/fks3kjd7hf

Upload a File

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

Based on: http://wiki.eclipse.org/Orion/Server_API/Transfer_API#Uploading_a_file.

Example Request

PUT /sap/hana/xs/dt/base/xfer/import/fks3kjd7hf

Orion-Version: 1.0
X-CSRF-Token: "65ABA3082325A3408FBE71C87929102B"
Content-Length: 32768
Content-Type: image/jpeg
Content-Range: bytes 0-32767/901024

Example Response

HTTP/1.1 200 success

Range: bytes 0-32767

Import a Zip Archive

By the chunked upload of a zip file the option "X-Xfer-Options: raw" means that the file is uploaded, but not unpacked. Otherwise the zip file will be unpacked into the target destination.

The chunked upload procedure for a zip file is similar to the file upload described above.

Based on: http://wiki.eclipse.org/Orion/Server_API/Transfer_API#Importing_a_zip.

Import Files Using Secure FTP

Not implemented.

Import Files Using a Single POST Call

To upload a file using a single POST call, omit the X-Xfer-Content-Length header, and include the file to be uploaded in the request body.

By the upload of a zip file the option "X-Xfer-Options: raw" means that the file is uploaded, but not unpacked. Otherwise the zip file will be unpacked into the target destination.

Based on: http://wiki.eclipse.org/Orion/Server_API/Transfer_API#Importing_a_file_via_a_single_POST_call.

Example Request

POST /sap/hana/xs/dt/base/xfer/import/MyProj/SomeFile.jpg

Orion-Version: 1.0
X-CSRF-Token: "65ABA3082325A3408FBE71C87929102B"
Content-Length: 901024
Content-Type: image/jpeg


This is the file contents

Example Response

HTTP/1.1 201 OK

Location: /sap/hana/xs/dt/base/file/MyProj/SomeFile.jpg
RunLocation: /MyProj/SomeFile.jpg

Import Files from a Remote URL

Not implemented.

Exporting Files

Export a File to a Client

Export of files and packages to the client in a zip archive.

Based on: http://wiki.eclipse.org/Orion/Server_API/Transfer_API#Export_to_client.

Example Request

GET /sap/hana/xs/dt/base/xfer/export/MyProj/SomeFolder.zip

Orion-Version: 1.0

Example Response

HTTP/1.1 201 OK

Content-Type: application/zip

File contents.

Export a File to Another Server Using Secure FTP

Not implemented.