Required role: | User |
POST | /app/files |
---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Voice.Api.App;
using Voice.Api.Files;
using Voice.Api;
using Voice.Api.Customers;
namespace Voice.Api
{
public partial class EntityInfo
{
///<summary>
///The ID of the object
///</summary>
[ApiMember(Description="The ID of the object")]
public virtual string Id { get; set; }
///<summary>
///The date the object was created
///</summary>
[ApiMember(Description="The date the object was created")]
public virtual string DateCreated { get; set; }
///<summary>
///The date the object was last modified
///</summary>
[ApiMember(Description="The date the object was last modified")]
public virtual string DateLastModified { get; set; }
///<summary>
///The user that created this object
///</summary>
[ApiMember(Description="The user that created this object")]
public virtual string CreatedBy { get; set; }
///<summary>
///The user that last modified this object
///</summary>
[ApiMember(Description="The user that last modified this object")]
public virtual string LastModifiedBy { get; set; }
}
}
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
: IPost
{
///<summary>
///The file data
///</summary>
[ApiMember(Description="The file data")]
public virtual byte[] Data { get; set; }
///<summary>
///The file name
///</summary>
[ApiMember(Description="The file name")]
public virtual string FileName { get; set; }
///<summary>
///The file's content type
///</summary>
[ApiMember(Description="The file's content type")]
public virtual string ContentType { get; set; }
///<summary>
///Convert the file to WAV to be safe?
///</summary>
[ApiMember(Description="Convert the file to WAV to be safe?")]
public virtual bool ConvertToWav { get; set; }
}
}
namespace Voice.Api.Customers
{
public partial class CustomerBreadcrumb
{
public virtual string Id { get; set; }
public virtual string Name { get; set; }
}
}
namespace Voice.Api.Files
{
public partial class FileInfo
: EntityInfo
{
///<summary>
///The type of file this is
///</summary>
[ApiMember(Description="The type of file this is")]
public virtual FileTypes Type { get; set; }
///<summary>
///The account ID this file is associated with
///</summary>
[ApiMember(Description="The account ID this file is associated with")]
public virtual string AccountId { get; set; }
///<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 virtual string AccountName { get; set; }
///<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 virtual string CustomerId { get; set; }
///<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 virtual string CustomerName { get; set; }
///<summary>
///The breadcrumb to the customer for this file
///</summary>
[ApiMember(Description="The breadcrumb to the customer for this file")]
public virtual List<CustomerBreadcrumb> CustomerBreadcrumb { get; set; }
///<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 virtual string UserId { get; set; }
///<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 virtual string UserName { get; set; }
///<summary>
///The original file name for the file
///</summary>
[ApiMember(Description="The original file name for the file")]
public virtual string FileName { get; set; }
///<summary>
///The URI of the file
///</summary>
[ApiMember(Description="The URI of the file")]
public virtual string Uri { get; set; }
///<summary>
///The Content type of the file
///</summary>
[ApiMember(Description="The Content type of the file")]
public virtual string ContentType { get; set; }
///<summary>
///The size of the file
///</summary>
[ApiMember(Description="The size of the file")]
public virtual long ContentLength { get; set; }
///<summary>
///The Twilio ID of the recording
///</summary>
[ApiMember(Description="The Twilio ID of the recording")]
public virtual string RecordingSid { get; set; }
///<summary>
///The duration of the recording in seconds
///</summary>
[ApiMember(Description="The duration of the recording in seconds")]
public virtual int RecordingDuration { get; set; }
///<summary>
///Who is the recording from?
///</summary>
[ApiMember(Description="Who is the recording from?")]
public virtual string RecordingFrom { get; set; }
///<summary>
///Transcription (if available)
///</summary>
[ApiMember(Description="Transcription (if available)")]
public virtual string Transcription { get; set; }
///<summary>
///From Address (e.g. caller ID) for incoming calls
///</summary>
[ApiMember(Description="From Address (e.g. caller ID) for incoming calls")]
public virtual string FromAddress { get; set; }
///<summary>
///To Address (e.g. dialed number) for outgoing calls
///</summary>
[ApiMember(Description="To Address (e.g. dialed number) for outgoing calls")]
public virtual string ToAddress { get; set; }
///<summary>
///The AI transcription for this call
///</summary>
[ApiMember(Description="The AI transcription for this call")]
public virtual string AITranscription { get; set; }
}
public enum FileTypes
{
Upload,
VoiceMessage,
CallRecording,
Fax,
Attachment,
FaxOutgoing,
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=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: team.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> <AITranscription>String</AITranscription> <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>