Update the content of an uploaded attachment
1 min
POST
https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content
Path Parameters
- clientIdstringrequiredDescription
- attachmentIdinteger<int64>requiredDescriptionFormatint64
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonapplication/vnd.optivo.broadmail.v1+json
Form Parameters
- filestring<binary>requiredDescriptionFormatbinary
- namestringDescription
Responses
200
- RestAttachment
- idinteger<int64>DescriptionFormatint64
- ownerinteger<int64>DescriptionFormatint64
- namestringDescription
- uploadedbooleanDescription
- fileNamestringDescription
- typestringDescription
- mimeTypestringDescription
- sizeinteger<int64>DescriptionFormatint64
- createdstring<date-time>DescriptionFormatdate-time
- modifiedstring<date-time>DescriptionFormatdate-time
- linksobject[]
- uriBuilderobject
- relsstring[]
- relstring
- typestring
- paramsmap<string, string>
- titlestring
- uristring<uri>Formaturi
404
curl
curl --request POST \
--url https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form 'file=@"/path/to/file"'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");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content", 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://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content")
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')]]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
python
import requests
url = "https://api.campaign.episerver.net/rest/{clientId}/attachments/{attachmentId}/content"
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
// The attachment content was updated successfully.
{
"id": "",
"owner": "",
"name": "",
"uploaded": false,
"fileName": "",
"type": "",
"mimeType": "",
"size": "",
"created": "",
"modified": "",
"links": [
{
"uriBuilder": {},
"rels": [
""
],
"rel": "",
"type": "",
"params": "",
"title": "",
"uri": ""
}
]
}404
// The attachment could not be found. Ensure that the required parameters such as "attachmentId" are correct and the attachment exists.