tvpl.api

<back to all web services

FileUpload

Upload file

Requires Authentication
The following routes are available for this service:
POST/uploadTải file
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports tvpl.api.ServiceModel
Imports tvpl.data.Models
Imports ServiceStack.Web
Imports tvpl.data.Constant

Namespace Global

    Namespace ServiceStack.Web

        Public Interface IHttpFile
            Property Name As String
            Property FileName As String
            Property ContentLength As Long
            Property ContentType As String
            Property InputStream As Stream
        End Interface
    End Namespace

    Namespace tvpl.api.ServiceModel

        '''<Summary>
        '''Upload file
        '''</Summary>
        Public Partial Class FileUpload
            Inherits FileUploadRequest
            Implements IPost
        End Class

        Public Interface IResponseRequest
            Property Code As Integer
            Property Message As String
        End Interface
    End Namespace

    Namespace tvpl.data.Constant

        Public Enum AccessType
            Public
            Restricted
        End Enum

        Public Enum StorageStatus
            Draft
            Permanent
            Archive
        End Enum
    End Namespace

    Namespace tvpl.data.Models

        Public Partial Class FileUploadRequest
            Public Overridable Property FileUpload As IHttpFile
            Public Overridable Property AccessType As AccessType
            Public Overridable Property StorageStatus As StorageStatus
        End Class
    End Namespace
End Namespace

VB.NET FileUpload DTOs

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

HTTP + CSV

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

POST /upload HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"fileUpload":null,"accessType":"Public","storageStatus":"Draft"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{Unable to show example output for type 'IResponseRequest' using the custom 'csv' filter}Cannot dynamically create an instance of type 'tvpl.api.ServiceModel.IResponseRequest'. Reason: Cannot create an instance of an interface.