Create project template reference files
curl --request POST \
--url https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'file={
"bytes": [
"aSDinaTvuI8gbWludGxpZnk="
],
"contentType": "<string>",
"empty": true,
"inputStream": {},
"name": "<string>",
"originalFilename": "<string>",
"resource": {
"description": "<string>",
"file": "<string>",
"filename": "<string>",
"inputStream": {},
"open": true,
"readable": true,
"uri": "<string>",
"url": "<string>"
},
"size": 123
}' \
--form file.items.resource.file='@example-file'import requests
url = "https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references"
files = { "file.items.resource.file": ("example-file", open("example-file", "rb")) }
payload = { "file": "{
\"bytes\": [
\"aSDinaTvuI8gbWludGxpZnk=\"
],
\"contentType\": \"<string>\",
\"empty\": true,
\"inputStream\": {},
\"name\": \"<string>\",
\"originalFilename\": \"<string>\",
\"resource\": {
\"description\": \"<string>\",
\"file\": \"<string>\",
\"filename\": \"<string>\",
\"inputStream\": {},
\"open\": true,
\"readable\": true,
\"uri\": \"<string>\",
\"url\": \"<string>\"
},
\"size\": 123
}" }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '{
"bytes": [
"aSDinaTvuI8gbWludGxpZnk="
],
"contentType": "<string>",
"empty": true,
"inputStream": {},
"name": "<string>",
"originalFilename": "<string>",
"resource": {
"description": "<string>",
"file": "<string>",
"filename": "<string>",
"inputStream": {},
"open": true,
"readable": true,
"uri": "<string>",
"url": "<string>"
},
"size": 123
}');
form.append('file.items.resource.file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references', 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/v1/projectTemplates/{projectTemplateUid}/references",
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\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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/v1/projectTemplates/{projectTemplateUid}/references"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/v1/projectTemplates/{projectTemplateUid}/references")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"referenceFiles": [
{
"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>",
"note": "<string>",
"uid": "<string>"
}
]
}Reference File
Create project template reference files
The json request part allows sending additional data as JSON, such as a text note that will be used for all the given reference files. In case no file parts are sent, only 1 reference is created with the given note. Either at least one file must be sent or the note must be specified. Example:
{
"note": "Sample text"
}
Required role: Administrator or Project Manager. Maximum 50 files per request.
POST
/
api2
/
v1
/
projectTemplates
/
{projectTemplateUid}
/
references
Create project template reference files
curl --request POST \
--url https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'file={
"bytes": [
"aSDinaTvuI8gbWludGxpZnk="
],
"contentType": "<string>",
"empty": true,
"inputStream": {},
"name": "<string>",
"originalFilename": "<string>",
"resource": {
"description": "<string>",
"file": "<string>",
"filename": "<string>",
"inputStream": {},
"open": true,
"readable": true,
"uri": "<string>",
"url": "<string>"
},
"size": 123
}' \
--form file.items.resource.file='@example-file'import requests
url = "https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references"
files = { "file.items.resource.file": ("example-file", open("example-file", "rb")) }
payload = { "file": "{
\"bytes\": [
\"aSDinaTvuI8gbWludGxpZnk=\"
],
\"contentType\": \"<string>\",
\"empty\": true,
\"inputStream\": {},
\"name\": \"<string>\",
\"originalFilename\": \"<string>\",
\"resource\": {
\"description\": \"<string>\",
\"file\": \"<string>\",
\"filename\": \"<string>\",
\"inputStream\": {},
\"open\": true,
\"readable\": true,
\"uri\": \"<string>\",
\"url\": \"<string>\"
},
\"size\": 123
}" }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '{
"bytes": [
"aSDinaTvuI8gbWludGxpZnk="
],
"contentType": "<string>",
"empty": true,
"inputStream": {},
"name": "<string>",
"originalFilename": "<string>",
"resource": {
"description": "<string>",
"file": "<string>",
"filename": "<string>",
"inputStream": {},
"open": true,
"readable": true,
"uri": "<string>",
"url": "<string>"
},
"size": 123
}');
form.append('file.items.resource.file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references', 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/v1/projectTemplates/{projectTemplateUid}/references",
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\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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/v1/projectTemplates/{projectTemplateUid}/references"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/v1/projectTemplates/{projectTemplateUid}/references")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v1/projectTemplates/{projectTemplateUid}/references")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n{\r\n \"bytes\": [\r\n \"aSDinaTvuI8gbWludGxpZnk=\"\r\n ],\r\n \"contentType\": \"<string>\",\r\n \"empty\": true,\r\n \"inputStream\": {},\r\n \"name\": \"<string>\",\r\n \"originalFilename\": \"<string>\",\r\n \"resource\": {\r\n \"description\": \"<string>\",\r\n \"file\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"inputStream\": {},\r\n \"open\": true,\r\n \"readable\": true,\r\n \"uri\": \"<string>\",\r\n \"url\": \"<string>\"\r\n },\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.items.resource.file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"referenceFiles": [
{
"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>",
"note": "<string>",
"uid": "<string>"
}
]
}Authorizations
ApiTokenOAuth2
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.
Path Parameters
Body
multipart/form-data
Multipart request with files and JSON
Response
Created
Show child attributes
Show child attributes
Was this page helpful?