tvpl.api

<back to all web services

FileUpload

Upload file

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

namespace ServiceStack.Web
{
    public partial interface IHttpFile
    {
        string Name { get; set; }
        string FileName { get; set; }
        long ContentLength { get; set; }
        string ContentType { get; set; }
        Stream InputStream { get; set; }
    }

}

namespace tvpl.api.ServiceModel
{
    ///<summary>
    ///Upload file
    ///</summary>
    public partial class FileUpload
        : FileUploadRequest, IPost
    {
    }

    public partial interface IResponseRequest
    {
        int Code { get; set; }
        string Message { get; set; }
    }

}

namespace tvpl.data.Constant
{
    public enum AccessType
    {
        Public,
        Restricted,
    }

    public enum StorageStatus
    {
        Draft,
        Permanent,
        Archive,
    }

}

namespace tvpl.data.Models
{
    public partial class FileUploadRequest
    {
        public virtual IHttpFile FileUpload { get; set; }
        public virtual AccessType AccessType { get; set; }
        public virtual StorageStatus StorageStatus { get; set; }
    }

}

C# 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.