Once you have registered and received your app token and test account, you are ready to start the integration process. Test accounts are only required for app developers that don’t already have a Transporter.
The current release of the Transporter API uses an Objective-C interface that handles all communication to the Transporter services and devices. Service communications are made through RESTful calls over HTTPS and device communications are made through a custom protocol that utilizes AES 256 encryption to ensure security.
The Transporter API will allow your app to do the following:
• Read and write files to / from Transporter(s)
• Create, rename, copy and delete files to / from Transporter(s)
• Create, rename, copy and delete folders to / from Transporter(s)
The current release of the Transporter API is focused on Windows, iOS and Mac OS X applications. Future versions of the API will include support for other platform applications.
The current package consists of two static libraries (libPublicAPIForTransporter.a in both simulator and device forms) and a header file (PublicAPIForTransporter.h).
All applications should use the static library and the header file provided. If required, you can linkBinaryWithLibraries (“libstdc++.dylib” and “libz.dylib”).
There are two paths to files and folders that developers need to be aware of:
1. PathOnTransporter is always relative to the Transporter directory.
a) [/] root of the Transporter directory
b) [/Transporter Library/photos] for accessing photos directory under Transporter Library
2. LocalPathToFile is always the absolute path of the folder on the local machine.
There are a few limitations with the current version of the API that you should be aware of:
1. The move command is not currently supported as a safeguard to ensure data integrity is preserved. Moves can cause unintended results due to the different nature of shared and unshared folders.
The first time you run the API, the following call will need to occur:
registerAndAuthenticateUser – to get app instance token and auth token for the user and password combination; should only be called the first time.
authenticateWithTokens – to get auth token for the user and password combination. This also starts the Transporter service and devices. AuthToken should be saved and only called again when the user logs out, logs in again, or a new user logs in.
Note: authenticateUser and authenticateWithTokens initialize the Transporter Service. There is a small delay between initializing and connecting with the device.
You have to make sure the device is connected, before you can getDirectoryContents, or make any Transporter calls.
After the first run, you will normally only need to call authenticateWithTokens when starting the API. The only exceptions are if the user invalidates the auth token by logging out or if authenticateWithTokens fails.
If the user removes the connection by logging out to their Transporter from your app, you can keep the app instance token, but should delete the account auth token.
Below are a few sample calls for copying a file and creating a folder. A full list of all supported calls is available in the header file you will receive after you
* copyFile - Copies a file from the specified remote path on the Transporter to the other specified remote path
* - [IN] fromPathOnTransporter: Relative to the transporter directory(source)
* - [IN] toPathOnTransporter: Relative to the transporter directory(destination)
* - [OUT] error: Returns error code if the input arguments are NIL or if the input parameters are invalid
* or any other error generated from the underlying layer.
* On success, the error code will be NIL.
* Returns YES if copy was successful.
* Note: User should check for the return BOOL value, before checking the progress
- (BOOL) copyFile: (NSString *)fromPathOnTransporter
abort:(BOOL *) abort
progress:(double *) progressInPercentage