Chunk Upload
Overview
The objective of these methods is to enable uploads of large documents without incurring a timeout. We suggest using these methods for individual file sizes of 250KB and above; we require using these methods for individual file sizes of 3MB and above.
The following web service methods allow the user to upload a file or more asynchronously to submitting a fax for transmission. They allow the user to upload the data in parts, so as to avoid the file size and timeout limits of a single upload.
Once the upload has been completed, you may submit your fax for transmission, while referencing the SessionID of the upload you have just completed. A typical usage will use the StartFileUpload method once, then use the UploadFileChunk method multiple times, each time uploading a part of the data. Once the data has been uploaded completely, a call to a SendfaxEx_2 is made. The call will provide a reference to uploaded data instead of providing the data as a parameter.
Method Reference
StartFileUpload
Description: Starts an upload session. Should be called first.
Name | Type | Comments |
---|---|---|
Username | String | As provided during registration |
Password | String | As provided during registration |
Output
Name | Type | Comments |
---|---|---|
SessionID | String | SessionID is an InterFAX-returned string to be used in a subsequent fax submission. |
StartFileUploadResult | Integer | Result code. 0 = OK, less than 0 = error, see Error codes (below) |
Error codes
Value | Description |
---|---|
-150 | Internal System Error. An exception occurs at any point in the execution of the web service method. |
-310 | The logged in user in context is not a primary user. User is not authorized to operate actions on RequestedUserID. |
-666 | The user is configured in another switch group. |
-677 | The user does not have any TX service registered |
-1003 | Authentication error: the user cannot be authenticated when either the username or the password is incorrect OR any other last error occurred when authenticating the user. |
-2003 | The request from the IP of the machine is not in a valid IP address range. |
UploadFileChunk
Description: Sends a buffer to the InterFAX host. Buffer size may vary between calls.
This method uploads a file in chunks of byte array passed with a valid Session ID token generated using the StartFileUpload web service method. When passing the IsLast value as true, the API web service method closes the stream, removes the Session ID token and sets the ExpiredAt property by adding the minutes of the session time out value to the current UTC date time.
Name | Type | Comments |
---|---|---|
SessionID | String | As received in the StartFileUpload method above. |
Chunk | base64Binary | Chunk of the file to be uploaded. Can be up to 3 MB. Recommended chunk size is between 50,000 to 200,000 bytes. The maximum total file size (of all chunks) is 20 MB. |
IsLast | Boolean | True if the chunk to be passed is the last chunk, otherwise false. |
Output
Name | Type | Comments |
---|---|---|
UploadFileChunkResult | Integer | Any positive value = OK. The value indicates the total number of bytes uploaded so far. Less than 0 = Error, see Expected error result codes (below) and Appendix A. |
Expected error result codes
Value | Description |
---|---|
-150 | Internal System Error. An exception occurs at any point in the execution of the web service method. |
-310 | The logged in user in context is not a primary user. User is not authorized to operate actions on RequestedUserID. |
-666 | The user is configured in another switch group. |
-677 | The user does not have any TX service registered |
-1003 | Authentication error: the user cannot be authenticated when either the username or the password is incorrect OR any other last error occurred when authenticating the user. |
-1061 | Missing chunk |
-1062 | SessionID incorrect |
-1063 | Total file size too big |
CancelFileUpload
Description: Cancels an already started session. There is no need to use it at the end of an upload session.
Name | Type | Comments |
---|---|---|
SessionID | String | SessionID of the active upload to be cancelled. |