POST api/Village/{village}/Medication

Add a medication. If photos are included, this method MUST be called with multipart/form-data encoding for the file.

The request payload for the image MAY include a pill photo, which MUST have Content-Disposition and Content-Type headers. The 'name' in the Content-Disposition header MUST be "pillphoto":

  • Content-Disposition: form-data; name="pillphoto"; filename="whatever-you-want"
  • Content-Type: mime/type
The request payload for the image MAY include a label photo, which MUST have Content-Disposition and Content-Type headers. The 'name' in the Content-Disposition header MUST be "labelphoto":
  • Content-Disposition: form-data; name="labelphoto"; filename="whatever-you-want"
  • Content-Type: mime/type

Request Information

URI Parameters

NameDescriptionTypeAdditional information
village

string

None.

Body Parameters

ApiAddMedicationModel
NameDescriptionTypeAdditional information
pillphoto

The pill photo

ApiFileUpload

None.

labelphoto

The label photo

ApiFileUpload

None.

RemovePillPhoto

If true and pillPhoto is null, remove the existing pill photo

boolean

None.

RemoveLabelPhoto

If true and labelPhoto is null, remove the existing label photo

boolean

None.

Name

Medication Name

string

Required

Form

Form of the medication (e.g. pill, tablet, capsule, etc.)

string

None.

StandardDosage

Standard dosage (from RXTerms API)

string

String length: inclusive between 0 and 255

CustomDosage

Custom dosage

string

String length: inclusive between 0 and 255

Frequency

Frequency (Legacy free text)

string

None.

Active

Whether or not this medication is currently being taken

boolean

None.

StartDate

Date the care recipient started taking the medication

date

Data type: Date

EndDate

Date the care recipient stopped taking or will stop taking the medication

date

Data type: Date

LastRefillDate

Date the medication was last filled

date

Data type: Date

RefillsRemaining

Number of refills remaining

integer

None.

Reason

Why the medication is being taken

string

None.

Notes

Additional notes

string

Data type: MultilineText

String length: inclusive between 0 and 2048

RXCUI

Unique ID for RX APIs

string

None.

LastUpdated

When the medication was last updated

date

None.

LastUpdatedBy

Who last updated the medication

string

None.

SendReminders

Whether or not to send reminders for missed(?) dosages

boolean

None.

MedicationFrequency

Frequency of dosages

MedicationFrequency

None.

DaysOfWeek

Which days of the week the medication is taken

Weekday

None.

NextDoseDate

The "next" dose date (if this is a date in the past, use it to calculate the next date)

date

None.

DailyFrequency

Daily frequency type

MedicationDailyFrequency

None.

DailyTimesValue

If DailyFrequency = TimesPerDay, DailyTimesValue = number of times. If DailyFrequency = XHours, DailyTimesValue = X

integer

None.

DoseTimes

; separated list of times when the doses are taken

string

None.

Request Formats

application/json, text/json

Sample:
{
  "pillphoto": null,
  "labelphoto": null,
  "RemovePillPhoto": true,
  "RemoveLabelPhoto": true,
  "Name": "sample string 3",
  "Form": "sample string 4",
  "StandardDosage": "sample string 5",
  "CustomDosage": "sample string 6",
  "Frequency": "sample string 7",
  "Active": true,
  "StartDate": "2025-06-02T15:42:46.058+00:00",
  "EndDate": "2025-06-02T15:42:46.058+00:00",
  "LastRefillDate": "2025-06-02T15:42:46.058+00:00",
  "RefillsRemaining": 1,
  "Reason": "sample string 9",
  "Notes": "sample string 10",
  "RXCUI": "sample string 11",
  "LastUpdated": "2025-06-02T15:42:46.058+00:00",
  "LastUpdatedBy": "sample string 13",
  "SendReminders": true,
  "MedicationFrequency": 0,
  "DaysOfWeek": 1,
  "NextDoseDate": "2025-06-02T15:42:46.058+00:00",
  "DailyFrequency": 0,
  "DailyTimesValue": 1,
  "DoseTimes": "sample string 15"
}

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 'ApiAddMedicationModel'.

Response Information

Resource Description

Medication model for the newly added medication

ViewMedicationModel
NameDescriptionTypeAdditional information
Id

Medication unique ID

globally unique identifier

None.

VillageId

Village unique ID

globally unique identifier

None.

HasPillPhoto

If true, a pill photo has been provided

boolean

None.

HasLabelPhoto

If true, a label photo has been provided

boolean

None.

Taken

List of when the medication was taken

Collection of MedicationListTakenModel

None.

Name

Medication Name

string

Required

Form

Form of the medication (e.g. pill, tablet, capsule, etc.)

string

None.

StandardDosage

Standard dosage (from RXTerms API)

string

String length: inclusive between 0 and 255

CustomDosage

Custom dosage

string

String length: inclusive between 0 and 255

Frequency

Frequency (Legacy free text)

string

None.

Active

Whether or not this medication is currently being taken

boolean

None.

StartDate

Date the care recipient started taking the medication

date

Data type: Date

EndDate

Date the care recipient stopped taking or will stop taking the medication

date

Data type: Date

LastRefillDate

Date the medication was last filled

date

Data type: Date

RefillsRemaining

Number of refills remaining

integer

None.

Reason

Why the medication is being taken

string

None.

Notes

Additional notes

string

Data type: MultilineText

String length: inclusive between 0 and 2048

RXCUI

Unique ID for RX APIs

string

None.

LastUpdated

When the medication was last updated

date

None.

LastUpdatedBy

Who last updated the medication

string

None.

SendReminders

Whether or not to send reminders for missed(?) dosages

boolean

None.

MedicationFrequency

Frequency of dosages

MedicationFrequency

None.

DaysOfWeek

Which days of the week the medication is taken

Weekday

None.

NextDoseDate

The "next" dose date (if this is a date in the past, use it to calculate the next date)

date

None.

DailyFrequency

Daily frequency type

MedicationDailyFrequency

None.

DailyTimesValue

If DailyFrequency = TimesPerDay, DailyTimesValue = number of times. If DailyFrequency = XHours, DailyTimesValue = X

integer

None.

DoseTimes

; separated list of times when the doses are taken

string

None.

Response Formats

application/json, text/json

Sample:
{
  "Id": "087f1df0-c28e-4290-a14f-035da6b8dfc0",
  "VillageId": "0d432b40-6849-4335-92d5-1d54a83d3235",
  "HasPillPhoto": true,
  "HasLabelPhoto": true,
  "Taken": [
    {
      "LoggedById": "1934e996-d3e6-4d10-8e97-412a8bc435b3",
      "Taken": "2025-06-02T15:42:46.152+00:00"
    },
    {
      "LoggedById": "1934e996-d3e6-4d10-8e97-412a8bc435b3",
      "Taken": "2025-06-02T15:42:46.152+00:00"
    }
  ],
  "Name": "sample string 5",
  "Form": "sample string 6",
  "StandardDosage": "sample string 7",
  "CustomDosage": "sample string 8",
  "Frequency": "sample string 9",
  "Active": true,
  "StartDate": "2025-06-02T15:42:46.152+00:00",
  "EndDate": "2025-06-02T15:42:46.152+00:00",
  "LastRefillDate": "2025-06-02T15:42:46.152+00:00",
  "RefillsRemaining": 1,
  "Reason": "sample string 11",
  "Notes": "sample string 12",
  "RXCUI": "sample string 13",
  "LastUpdated": "2025-06-02T15:42:46.152+00:00",
  "LastUpdatedBy": "sample string 15",
  "SendReminders": true,
  "MedicationFrequency": 0,
  "DaysOfWeek": 1,
  "NextDoseDate": "2025-06-02T15:42:46.152+00:00",
  "DailyFrequency": 0,
  "DailyTimesValue": 1,
  "DoseTimes": "sample string 17"
}

application/xml, text/xml

Sample:
<ViewMedicationModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CaringVillage.Shared.Implementation.Models">
  <Active>true</Active>
  <CustomDosage>sample string 8</CustomDosage>
  <DailyFrequency>None</DailyFrequency>
  <DailyTimesValue>1</DailyTimesValue>
  <DaysOfWeek>Sunday</DaysOfWeek>
  <DoseTimes>sample string 17</DoseTimes>
  <EndDate>2025-06-02T15:42:46.1521907+00:00</EndDate>
  <Form>sample string 6</Form>
  <Frequency>sample string 9</Frequency>
  <LastRefillDate>2025-06-02T15:42:46.1521907+00:00</LastRefillDate>
  <LastUpdated>2025-06-02T15:42:46.1521907+00:00</LastUpdated>
  <LastUpdatedBy>sample string 15</LastUpdatedBy>
  <MedicationFrequency>None</MedicationFrequency>
  <Name>sample string 5</Name>
  <NextDoseDate>2025-06-02T15:42:46.1521907+00:00</NextDoseDate>
  <Notes>sample string 12</Notes>
  <RXCUI>sample string 13</RXCUI>
  <Reason>sample string 11</Reason>
  <RefillsRemaining>1</RefillsRemaining>
  <SendReminders>true</SendReminders>
  <StandardDosage>sample string 7</StandardDosage>
  <StartDate>2025-06-02T15:42:46.1521907+00:00</StartDate>
  <HasLabelPhoto>true</HasLabelPhoto>
  <HasPillPhoto>true</HasPillPhoto>
  <Id>087f1df0-c28e-4290-a14f-035da6b8dfc0</Id>
  <Taken>
    <MedicationListTakenModel>
      <LoggedById>1934e996-d3e6-4d10-8e97-412a8bc435b3</LoggedById>
      <Taken>2025-06-02T15:42:46.1521907+00:00</Taken>
    </MedicationListTakenModel>
    <MedicationListTakenModel>
      <LoggedById>1934e996-d3e6-4d10-8e97-412a8bc435b3</LoggedById>
      <Taken>2025-06-02T15:42:46.1521907+00:00</Taken>
    </MedicationListTakenModel>
  </Taken>
  <VillageId>0d432b40-6849-4335-92d5-1d54a83d3235</VillageId>
</ViewMedicationModel>