Evo Voice

<back to all web services

UploadFile

Create a new file and return the info

Requires Authentication
Required role:User
The following routes are available for this service:
POST/app/files
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Voice.Api.App
Imports Voice.Api.Files
Imports Voice.Api
Imports Voice.Api.Customers

Namespace Global

    Namespace Voice.Api

        Public Partial Class EntityInfo
            '''<Summary>
            '''The ID of the object
            '''</Summary>
            <ApiMember(Description:="The ID of the object")>
            Public Overridable Property Id As String

            '''<Summary>
            '''The date the object was created
            '''</Summary>
            <ApiMember(Description:="The date the object was created")>
            Public Overridable Property DateCreated As String

            '''<Summary>
            '''The date the object was last modified
            '''</Summary>
            <ApiMember(Description:="The date the object was last modified")>
            Public Overridable Property DateLastModified As String

            '''<Summary>
            '''The user that created this object
            '''</Summary>
            <ApiMember(Description:="The user that created this object")>
            Public Overridable Property CreatedBy As String

            '''<Summary>
            '''The user that last modified this object
            '''</Summary>
            <ApiMember(Description:="The user that last modified this object")>
            Public Overridable Property LastModifiedBy As String
        End Class
    End Namespace

    Namespace Voice.Api.App

        '''<Summary>
        '''Create a new file and return the info
        '''</Summary>
        <Api(Description:="Create a new file and return the info")>
        Public Partial Class UploadFile
            Implements IPost
            Public Sub New()
                Data = New Byte(){}
            End Sub

            '''<Summary>
            '''The file data
            '''</Summary>
            <ApiMember(Description:="The file data")>
            Public Overridable Property Data As Byte()

            '''<Summary>
            '''The file name
            '''</Summary>
            <ApiMember(Description:="The file name")>
            Public Overridable Property FileName As String

            '''<Summary>
            '''The file's content type
            '''</Summary>
            <ApiMember(Description:="The file's content type")>
            Public Overridable Property ContentType As String

            '''<Summary>
            '''Convert the file to WAV to be safe?
            '''</Summary>
            <ApiMember(Description:="Convert the file to WAV to be safe?")>
            Public Overridable Property ConvertToWav As Boolean
        End Class
    End Namespace

    Namespace Voice.Api.Customers

        Public Partial Class CustomerBreadcrumb
            Public Overridable Property Id As String
            Public Overridable Property Name As String
        End Class
    End Namespace

    Namespace Voice.Api.Files

        Public Partial Class FileInfo
            Inherits EntityInfo
            Public Sub New()
                CustomerBreadcrumb = New List(Of CustomerBreadcrumb)
            End Sub

            '''<Summary>
            '''The type of file this is
            '''</Summary>
            <ApiMember(Description:="The type of file this is")>
            Public Overridable Property Type As FileTypes

            '''<Summary>
            '''The account ID this file is associated with
            '''</Summary>
            <ApiMember(Description:="The account ID this file is associated with")>
            Public Overridable Property AccountId As String

            '''<Summary>
            '''The name of the account this file is associated with
            '''</Summary>
            <ApiMember(Description:="The name of the account this file is associated with")>
            Public Overridable Property AccountName As String

            '''<Summary>
            '''The ID of the customer this file is associated with
            '''</Summary>
            <ApiMember(Description:="The ID of the customer this file is associated with")>
            Public Overridable Property CustomerId As String

            '''<Summary>
            '''The name of the customer this file is associated with
            '''</Summary>
            <ApiMember(Description:="The name of the customer this file is associated with")>
            Public Overridable Property CustomerName As String

            '''<Summary>
            '''The breadcrumb to the customer for this file
            '''</Summary>
            <ApiMember(Description:="The breadcrumb to the customer for this file")>
            Public Overridable Property CustomerBreadcrumb As List(Of CustomerBreadcrumb)

            '''<Summary>
            '''The ID of the user this file is assocaited with
            '''</Summary>
            <ApiMember(Description:="The ID of the user this file is assocaited with")>
            Public Overridable Property UserId As String

            '''<Summary>
            '''The name of the user this file is associated with
            '''</Summary>
            <ApiMember(Description:="The name of the user this file is associated with")>
            Public Overridable Property UserName As String

            '''<Summary>
            '''The original file name for the file
            '''</Summary>
            <ApiMember(Description:="The original file name for the file")>
            Public Overridable Property FileName As String

            '''<Summary>
            '''The URI of the file
            '''</Summary>
            <ApiMember(Description:="The URI of the file")>
            Public Overridable Property Uri As String

            '''<Summary>
            '''The Content type of the file
            '''</Summary>
            <ApiMember(Description:="The Content type of the file")>
            Public Overridable Property ContentType As String

            '''<Summary>
            '''The size of the file
            '''</Summary>
            <ApiMember(Description:="The size of the file")>
            Public Overridable Property ContentLength As Long

            '''<Summary>
            '''The Twilio ID of the recording
            '''</Summary>
            <ApiMember(Description:="The Twilio ID of the recording")>
            Public Overridable Property RecordingSid As String

            '''<Summary>
            '''The duration of the recording in seconds
            '''</Summary>
            <ApiMember(Description:="The duration of the recording in seconds")>
            Public Overridable Property RecordingDuration As Integer

            '''<Summary>
            '''Who is the recording from?
            '''</Summary>
            <ApiMember(Description:="Who is the recording from?")>
            Public Overridable Property RecordingFrom As String

            '''<Summary>
            '''Transcription (if available)
            '''</Summary>
            <ApiMember(Description:="Transcription (if available)")>
            Public Overridable Property Transcription As String

            '''<Summary>
            '''From Address (e.g. caller ID) for incoming calls
            '''</Summary>
            <ApiMember(Description:="From Address (e.g. caller ID) for incoming calls")>
            Public Overridable Property FromAddress As String

            '''<Summary>
            '''To Address (e.g. dialed number) for outgoing calls
            '''</Summary>
            <ApiMember(Description:="To Address (e.g. dialed number) for outgoing calls")>
            Public Overridable Property ToAddress As String
        End Class

        Public Enum FileTypes
            Upload
            VoiceMessage
            CallRecording
            Fax
            Attachment
            FaxOutgoing
        End Enum
    End Namespace
End Namespace

VB.NET UploadFile DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /app/files HTTP/1.1 
Host: evovoice.io 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UploadFile xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.App">
  <ContentType>String</ContentType>
  <ConvertToWav>false</ConvertToWav>
  <Data>AA==</Data>
  <FileName>String</FileName>
</UploadFile>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<FileInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Files">
  <CreatedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</CreatedBy>
  <DateCreated xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateCreated>
  <DateLastModified xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateLastModified>
  <Id xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</Id>
  <LastModifiedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</LastModifiedBy>
  <AccountId>String</AccountId>
  <AccountName>String</AccountName>
  <ContentLength>0</ContentLength>
  <ContentType>String</ContentType>
  <CustomerBreadcrumb xmlns:d2p1="http://schemas.datacontract.org/2004/07/Voice.Api.Customers">
    <d2p1:CustomerBreadcrumb>
      <d2p1:Id>String</d2p1:Id>
      <d2p1:Name>String</d2p1:Name>
    </d2p1:CustomerBreadcrumb>
  </CustomerBreadcrumb>
  <CustomerId>String</CustomerId>
  <CustomerName>String</CustomerName>
  <FileName>String</FileName>
  <FromAddress>String</FromAddress>
  <RecordingDuration>0</RecordingDuration>
  <RecordingFrom>String</RecordingFrom>
  <RecordingSid>String</RecordingSid>
  <ToAddress>String</ToAddress>
  <Transcription>String</Transcription>
  <Type>Upload</Type>
  <Uri>String</Uri>
  <UserId>String</UserId>
  <UserName>String</UserName>
</FileInfo>