POST api/Village/{village}/Event/{activityId}/Attachment

Upload an attachment. This method MUST be called with multipart/form-data encoding for the file. The request payload for the image MUST have Content-Disposition and Content-Type headers. The 'name' in the Content-Disposition header MUST be "file": Content-Disposition: form-data; name="file"; filename="whatever-you-want"Content-Type: mime/type

Request Information

URI Parameters

NameDescriptionTypeAdditional information
activityId

globally unique identifier

Required

village

string

None.

Body Parameters

ApiRawUploadModel
NameDescriptionTypeAdditional information
file

The file to be uploaded

ApiFileUpload

None.

Request Formats

application/json, text/json

Sample:
{
  "file": null
}

application/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'application/xml'. Exception message: Type 'CaringVillage.API.Models.ApiFileUpload' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.

text/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'text/xml'. Exception message: Type 'CaringVillage.API.Models.ApiFileUpload' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.

multipart/form-data

Sample:

Failed to generate the sample for media type 'multipart/form-data'. Cannot use formatter 'MultipartMediaTypeFormatter' to write type 'ApiRawUploadModel'.

Response Information

Resource Description

Document model for the newly uploaded document

AttachmentModel
NameDescriptionTypeAdditional information
Id

Attachment ID

globally unique identifier

None.

Size

File size

integer

None.

FileName

Original File Name

string

None.

ContentType

MIME Content Type

string

None.

UploadedBy

Name of user who uploaded the attachment

string

None.

Response Formats

application/json, text/json

Sample:
{
  "Id": "597c5f68-b209-4fa2-a158-6aa672b16823",
  "Size": 2,
  "FileName": "sample string 3",
  "ContentType": "sample string 4",
  "UploadedBy": "sample string 5"
}

application/xml, text/xml

Sample:
<AttachmentModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CaringVillage.Shared.Implementation.Models">
  <ContentType>sample string 4</ContentType>
  <FileName>sample string 3</FileName>
  <Id>597c5f68-b209-4fa2-a158-6aa672b16823</Id>
  <Size>2</Size>
  <UploadedBy>sample string 5</UploadedBy>
</AttachmentModel>