Upload task file
1 min
POST
https://dev1.frontu.com//client/api/v2/files/upload
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonExampleExample with custom values
Form Parameters
- filestring<binary>requiredFormatbinary
- taskstringrequired
Responses
200
- object
- versioninteger
- originalNamestring
- pathstring
- checksumstring
- contentLengthstring
- taskstring
- taskRequeststring
- guidstring
- createdstring
- updatedstring
400
404
curl
curl --request POST \
--url https://dev1.frontu.com//client/api/v2/files/upload \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form 'file=@"/path/to/file"' \
--form 'task="string"'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "multipart/form-data");
var formdata = new FormData();
formdata.append("file", fileInput.files[0], "file");
formdata.append("task", "string");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://dev1.frontu.com//client/api/v2/files/upload", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "net/http"
url = URI("https://dev1.frontu.com//client/api/v2/files/upload")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "multipart/form-data"
form_data = [['file', File.open('/path/to/file')],['task', File.open('undefined')]]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
python
import requests
url = "https://dev1.frontu.com//client/api/v2/files/upload"
payload = {}
files=[
('file',('file',open('/path/to/file','rb'),'application/octet-stream'))
]
headers = {
'accept': 'application/json',
'content-type': 'multipart/form-data'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
200
// Returned when successful
{
"version": 0,
"originalName": "",
"path": "",
"checksum": "",
"contentLength": "",
"task": "",
"taskRequest": "",
"guid": "",
"created": "",
"updated": ""
}400
// Bad Request
404
// Entity not found