tvpl.api

<back to all web services

FileUpload

Upload file

Requires Authentication
The following routes are available for this service:
POST/uploadTải file

export interface IHttpFile
{
    name: string;
    fileName: string;
    contentLength: number;
    contentType: string;
    inputStream: string;
}

export enum AccessType
{
    Public = 'Public',
    Restricted = 'Restricted',
}

export enum StorageStatus
{
    Draft = 'Draft',
    Permanent = 'Permanent',
    Archive = 'Archive',
}

export class FileUploadRequest
{
    public fileUpload?: IHttpFile;
    public accessType: AccessType;
    public storageStatus: StorageStatus;

    public constructor(init?: Partial<FileUploadRequest>) { (Object as any).assign(this, init); }
}

export interface IResponseRequest
{
    code: number;
    message: string;
}

/** @description Upload file */
export class FileUpload extends FileUploadRequest implements IPost
{

    public constructor(init?: Partial<FileUpload>) { super(init); (Object as any).assign(this, init); }
}

TypeScript FileUpload DTOs

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

HTTP + OTHER

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/jsonl
Content-Type: text/jsonl
Content-Length: length

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

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