[This is preliminary documentation and is subject to change.]

Sideloads a file into the Phone Sherpa system from a public URL.

Namespace:  PhoneSherpa.Services
Assembly:  App_Code.fxrph_yi (in App_Code.fxrph_yi)
Version: 0.0.0.0

Syntax

C#
public WS..::.LoadFileFromUrlResult LoadFileFromUrl(
	string AccessKey,
	string URL
)
Visual Basic (Declaration)
Public Function LoadFileFromUrl ( _
	AccessKey As String, _
	URL As String _
) As WS..::.LoadFileFromUrlResult
JScript
public function LoadFileFromUrl(
	AccessKey : String, 
	URL : String
) : WS..::.LoadFileFromUrlResult

Parameters

AccessKey
Type: System..::.String
Security key allocated to a developer enabling access to the web service API.
URL
Type: System..::.String
A public URL to a content file.

Return Value

The internal source file handle and original file name as the FriendlyFileName.

Remarks

LoadFileFromURL transfers files from an external site into Phone Sherpa's systems. This step essentially copies the content file onto Phone Sherpa's servers so that it can be used in all subsequent API calls. Phone Sherpa performs an HTTP GET on the URL and sideloads (loads directly from server to server) the content file.

This function is most often used as a secure method of transfering files into the Phone Sherpa system. Secure meaning the source file is never passed to or is viewable by an end user client. This is useful when mobilizing a library of existing full track audio content, for example. Each track can be sent secretly to Phone Sherpa without the end user knowing the source file location. The custom ringtone store sample demonstrates this usage pattern.

Files tranfered via the LoadFileFromURL function are cached internally on Phone Sherpa's servers for 24 hours then are automatically flushed from the system. Caching greatly improves performance and saves bandwith by eliminating the need to sideload popular files. Calling this function with the same URL will check the cache first before attempting to do an HTTP GET on the URL.

Further access security to the source audio URL can be added by configuring the host application's web servers to accept only requests from the phonesherpa.com domain. All HTTP GET requests to the source file URL will come from this domain.

Note that files must be 10mb or less in size.

Below is an example of how to use this function, there is also an end-to-end example app of how to build a custom ringtone store based on sideloaded URLs in the Sample and Demo section of the SDK.

CopyVB.NET
Public Function SideLoadFile() As String
    Dim SherpaService As New PhoneSherpa.Services.WS

    'Upload the secret source file into Phone Sherpa's system.  If file was uploaded within the past 24 hours a cached version is used.
    'The source file URL is never exposed to the user and the transfered file is not accessible via the API's
    Dim LoadFile_Response As New PhoneSherpa.Services.LoadFileFromUrlResult
    Dim URL As String = "http://sdk.phonesherpa.com/samples/custom_ringtone_store_1/app/samplesource1.mp3"

    LoadFile_Response = SherpaService.LoadFileFromUrl("My_WSAccessKey", URL)

    'Check the error code to make sure the WS call succeeded
    If LoadFile_Response.Result.ErrorCode = 0 Then
        'call succeeded, capture the internal source file name so that it can be used in other API function calls
        Dim InternalSourceFile As String = LoadFile_Response.EditableFileName
        Dim FriendlyFileName As String = LoadFile_Response.FriendlyFileName

        Return InternalSourceFile
    Else
        'error transfering the file, handle it here
    End If
End Function

See Also