| POST | /upload | Tải file |
|---|
import java.math.*
import java.util.*
import net.servicestack.client.*
/**
* Upload file
*/
open class FileUpload : FileUploadRequest(), IPost
{
}
open class FileUploadRequest
{
var fileUpload:IHttpFile? = null
var accessType:AccessType? = null
var storageStatus:StorageStatus? = null
}
open interface IHttpFile
{
var name:String?
var fileName:String?
var contentLength:Long?
var contentType:String?
var inputStream:InputStream?
}
enum class AccessType
{
Public,
Restricted,
}
enum class StorageStatus
{
Draft,
Permanent,
Archive,
}
open interface IResponseRequest
{
var code:Int?
var message:String?
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=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.