Add an Attachment

Use the AddAttachment endpoint to attach a file to any board record.

To successfully attach a file to an entry, the board must have a field that has been marked as an input with a type of "file." See <input> for more information.

AddAttachment endpoint description
Description Attaches a file to a board record
URL /board/[boardname]/input/[inputviewname]/[dataid]/attachments/[attachmentfilename]
Method POST
Parameters
  • boardname

  • inputviewname

  • dataid

  • attachmentfilename

  • file

Review the parameter definitions and examples of how to use the AddAttachment endpoint in JavaScript and C# calls.

Parameters

AddAttachment endpoint parameters
Variable Name Type Description Required
boardname String Name of the board containing the record to which you want to add the attachment True (URL)
inputviewname String Name of the view that contains the input fields for the record type True (URL)
dataid Integer Unique ID of the record to which you want to add the attachment True (URL)
file File File that will be attached to the record True
attachmentfilename String The file name of the attachment. True

Examples

JavaScript Call

The name of the WebEOC Nexus field that will store the attachment is part of the post request. In this Javascript example that field is called "attachmentFileData."

Copy Code
var file = document.getElementById('fileinput').files[0]; 
var formData = new FormData(); 
formData.append('attachmentFileData', file, file.name); 
await fetch(`${baseUrl}/board/PressRelease/input/Input/1/attachments/press_release`, {
method: 'POST'
body: formData
})

C# Call

Copy Code
public async Task AddAttachment()
{
using (var httpClient = new HttpClient(httpClientHandler))
{
var content = new MultipartFormDataContent("Upload----" + Guid.NewGuid());
// image is byte array, or use an existing stream, or... 
content.Add(new StreamContent(new MemoryStream(image)),
"bilddatei", "upload.jpg");

await httpClient.PostAsync($"{baseUrl}/board/Press Release/input/Input/1/attachments/press_release", content);
}
}