curl --request POST \
--url https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'Memsource: <memsource>' \
--form file='@example-file'import requests
url = "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Memsource": "<memsource>",
"Authorization": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {
method: 'POST',
headers: {Memsource: '<memsource>', Authorization: '<api-key>'}
};
options.body = form;
fetch('https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data",
"Memsource: <memsource>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Memsource", "<memsource>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")
.header("Memsource", "<memsource>")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Memsource"] = '<memsource>'
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"action": "GUI_UPLOAD",
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"dateCreated": "2023-11-07T05:31:56Z",
"fileName": "<string>",
"id": "<string>"
}Upload file (async)
Upload a file to a subfolder of the selected connector. The upload is processed asynchronously; the response contains the id of the created async task, whose status can be tracked via Get Connector async task states.
curl --request POST \
--url https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'Memsource: <memsource>' \
--form file='@example-file'import requests
url = "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Memsource": "<memsource>",
"Authorization": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {
method: 'POST',
headers: {Memsource: '<memsource>', Authorization: '<api-key>'}
};
options.body = form;
fetch('https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data",
"Memsource: <memsource>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Memsource", "<memsource>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")
.header("Memsource", "<memsource>")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Memsource"] = '<memsource>'
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"action": "GUI_UPLOAD",
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"dateCreated": "2023-11-07T05:31:56Z",
"fileName": "<string>",
"id": "<string>"
}Authorizations
Get a token from auth/login endpoint and then pass it in the Authorization HTTP header in every subsequent API call. For more information visit our help center.
Headers
multipart/form-data Path Parameters
Internal numeric ID of the connector
Hex-encoded remote folder path
Hex-encoded remote file name
Query Parameters
Mime type of the file to upload
Body
Translated file to upload
Response
OK
Type of the async file operation, e.g. API_DOWNLOAD or API_UPLOAD
GUI_UPLOAD, GUI_DOWNLOAD, GUI_REIMPORT, GUI_REIMPORT_TARGET, CJ_UPLOAD, CJ_DOWNLOAD, APC_UPLOAD, APC_DOWNLOAD, API_UPLOAD, API_DOWNLOAD, SUBMITTER_PORTAL_DOWNLOAD Show child attributes
Show child attributes
Timestamp when the async task was created
Name of the file
Internal numeric ID of the async task, encoded as a string
Was this page helpful?