POST api/File/UploadFile
Upload a file. Please note that unless added the returned attachment model is added to an activity within 48 hours the file will be removed.
Exceptions
| Exception | Condition |
|---|---|
| UnauthorizedAccessException |
Thrown if you do not have a valid login ticket |
| ArgumentMissingHttpResponseException |
Thrown if there is no file present |
| ArgumentOutOfRangeHttpResponseException |
Thrown if there is more than one file present |
Remarks
You should use enctype="multipart/form-data" when you post data to this function as illustrated in the example below. In addition to uploaded file you should specify the following additional parameters
- TicketId (required), you login ticket
- Name (optional), the name of the file. If not specified we will use the original filename.
- Description (optional), a description of the file
- Category (optional), the category the file belongs to. Use LookupController.GetLookupValues(LookupController.GetLookupArgumentModel) with LookupId="AttachmentCategories" to get a list of valig categories
- Visible (optional), visibility of the file. If not specified visibility will be set to off, that is, the file will be private.
- Culture (optional), used to generate error messages in correct language
Examples
The sample below shows how create an upload form and post it using jQuery.
<form id="uploadForm" method="post" enctype="multipart/form-data" >
<input id="Attachment" name="Attachment" type="file" placeholder="Type in attachment id" /><br />
<input id="TicketId" name="TicketId" type="hidden" />
<input type = "button" value="JQuery Submit" onclick="uploadFile()" />
</form>
Make sure that input controls that matches the additional parameters this function requires use the name attribute. Also make sure that enctype is set to "multipart/form-data". The
JavaScript snippet shows how to post this form using jQuery
function uploadFile() {
//Get the form
var formData = new FormData($("#uploadForm")[0]);
$.ajax({
url: http://eConnect.infocare.com/api/File/UploadFile,
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false
})
.done(function (result){
console.log("Id : " + result.AttachmentId);
})
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
Additional information about the upload file such as the Id assigned to the file.
AttachmentModel| Name | Description | Type | Additional information |
|---|---|---|---|
| AttachmentId |
Gets or sets the attachment id |
string |
None. |
| CreatedAt |
Gets or sets the creation date |
date |
None. |
| CreatedBy |
Gets or sets the SAMAccountName for the user that created the attachment |
string |
None. |
| Title |
Gets or sets the attachment name |
string |
None. |
| FileName |
Gets or sets the attachment name, including extension |
string |
None. |
| MimeType |
Gets or sets the attachment MIME type |
string |
None. |
| Description |
Gets or sets the attachment description |
string |
Json null value handling: Ignore |
| Category |
Gets or sets the attachment category. Built in reports will have the predefined value of "Report" |
string |
None. |
| Type |
Gets or sets "Normal", "Signature" or "Report" attachment type |
RostovAttachmentType |
None. |
| IsDeletable |
Gets or sets whether this attachment can be deleted |
boolean |
None. |
| IsVisible |
Gets or sets whether this attachment can be viewed |
boolean |
None. |
Response Formats
application/json, text/json
{
"AttachmentId": "sample string 1",
"CreatedAt": "2026-11-11T19:51:38.8526713+01:00",
"CreatedBy": "sample string 3",
"Title": "sample string 4",
"FileName": "sample string 5",
"MimeType": "sample string 6",
"Description": "sample string 7",
"Category": "sample string 8",
"Type": 0,
"IsDeletable": true,
"IsVisible": true
}
application/xml, text/xml
<AttachmentModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">
<AttachmentId>sample string 1</AttachmentId>
<Category>sample string 8</Category>
<CreatedAt>2026-11-11T19:51:38.8526713+01:00</CreatedAt>
<CreatedBy>sample string 3</CreatedBy>
<Description>sample string 7</Description>
<FileName>sample string 5</FileName>
<IsDeletable>true</IsDeletable>
<IsVisible>true</IsVisible>
<MimeType>sample string 6</MimeType>
<Title>sample string 4</Title>
<Type>Normal</Type>
</AttachmentModel>