Rest - Contacts - Participants - Conditions

From Views API Documentation
Jump to navigation Jump to search

Purpose

Used for creating, editing and deleting conditions against a participant in the Views system.

Base URL

https://app.viewsapp.net/api/restful/contacts/participants/<id>/conditions

Schema

https://app.viewsapp.net/api/restful/contacts/participants/conditions/scheme(.xml|.json|.xsd)

Adding Conditions

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

<xml> should be in the following format:

<condition id="5">
  <ConditionID>3</ConditionID>
  <RequiresMedication>1</RequiresMedication>
  <Note>This is a test note.</Note>
  <MedicationEnd>2011-06-30</MedicationEnd>
</condition>

If there is a problem with creating that record, you will get a response containing all the errors, plus a copy of the translated data you supplied.

If the record was created successfully, the service will return a complete record for the newly created record if the attribute id set as the newly created id.

Listing Conditions

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml

This will list all conditions under a participant.

<?xml version="1.0" encoding="utf-8"?>
<participant id="19">
 <conditions>
   <condition id="7">
     <ID>7</ID>
     <PersonID>19</PersonID>
     <ConditionID>1</ConditionID>
     <RequiresMedication>0</RequiresMedication>
     <Note>This is a test note.</Note>
     <MedicationEnd>0000-00-00</MedicationEnd>
     <Created>2011-06-30 14:25:38</Created>
     <CreatedBy>jonathan</CreatedBy>
     <Updated>2011-06-30 14:25:38</Updated>
     <UpdatedBy>jonathan</UpdatedBy>
     <Condition>Condition 2</Condition>
     <Category>Mobility</Category>
   </condition>
   <condition id="6">
     <ID>6</ID>
     <PersonID>19</PersonID>
     <ConditionID>2</ConditionID>
     <RequiresMedication>0</RequiresMedication>
     <Note>This is a test note.</Note>
     <MedicationEnd>0000-00-00</MedicationEnd>
     <Created>2011-06-30 14:25:34</Created>
     <CreatedBy>jonathan</CreatedBy>
     <Updated>2011-06-30 14:25:34</Updated>
     <UpdatedBy>jonathan</UpdatedBy>
     <Condition>Condition 3</Condition>
     <Category>Mobility</Category>
   </condition>
   <condition id="5">
     <ID>5</ID>
     <PersonID>19</PersonID>
     <ConditionID>3</ConditionID>
     <RequiresMedication>1</RequiresMedication>
     <Note>This is a test note.</Note>
     <MedicationEnd>2011-06-30</MedicationEnd>
     <Created>2011-06-30 14:25:28</Created>
     <CreatedBy>jonathan</CreatedBy>
     <Updated>2014-02-25 09:55:14</Updated>
     <UpdatedBy>al.mccaig.transit</UpdatedBy>
     <Condition>Condition 1</Condition>
     <Category>Learning/Cognitive</Category>
   </condition>
 </conditions>
</participant>

Fetching a Specific Condition

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml
  • id - The ID of the condition entry

This will return a records similar to the following:

<?xml version="1.0" encoding="utf-8"?>
<condition id="5">
 <ID>5</ID>
 <PersonID>19</PersonID>
 <ConditionID>3</ConditionID>
 <RequiresMedication>1</RequiresMedication>
 <Note>This is a test note.</Note>
 <MedicationEnd>2011-06-30</MedicationEnd>
 <Created>2011-06-30 14:25:28</Created>
 <CreatedBy>jonathan</CreatedBy>
 <Updated>2014-02-25 09:55:14</Updated>
 <UpdatedBy>al.mccaig.transit</UpdatedBy>
 <Condition>Condition 1</Condition>
 <Category>Learning/Cognitive</Category>
</condition>

Updating an Address Book Entry

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"
  • id - The ID of the condition entry

The XML should be in the same format as the create, as specified by the schema

Deleting an Address Book Entry

curl --url <Base URL>/<id> -u<username>:<password> -H Content-Type:text/xml -X DELETE
  • id - The ID of the condition entry

This should be used with great care as it will permanently delete conditions from the participant.