Internal Medication API Subsystem

From GrandCare Systems
Revision as of 17:10, 27 August 2012 by Ngh (talk | contribs) (Created page with " The Medication subsystem allows you to create, view, edit and delete medications from a system via GCAPI. = Operations = == create == Create a medication === Parameters =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Medication subsystem allows you to create, view, edit and delete medications from a system via GCAPI.

Operations

create

Create a medication

Parameters

  • firstname - [required] - First name
  • lastname - [required] - Last name
  • id - [optional] - Unique ID in UUID format
  • email - [optional] - Email address
  • address - [optional] - Street address
  • city - [optional] - City
  • state - [optional] - State
  • zip - [optional] - Zip code
  • homephone - [optional] - Home phone number
  • workphone - [optional] - Work phone number
  • cellphone - [optional] - Cell phone number
  • pager - [optional] - Pager phone number

Results

SUCCESS, returns back saved medication

xml

$ curl "http://10.100.1.2/api/medication.php?op=create&encoding=xml&passcode=x&firstname=Nicholas&lastname=Hall&address=123+Fake+St&state=WI&zipcode=53095&city=West+Bend"
<gcapi>
 <result>SUCCESS</result>
 <medication>
   <id>cbaaf355-9c16-4a24-858b-869f6bf303f9</id>
   <firstname>Nicholas</firstname>
   <lastname>Hall</lastname>
   <address>123 Fake St</address>
   <city>West Bend</city>
   <state>WI</state>
   <zipcode>53095</zipcode>
   <homephone> </homephone>
   <workphone> </workphone>
   <cellphone> </cellphone>
   <pager> </pager>
   <email> </email>
 </medication>
</gcapi>

json

$ curl "http://10.100.1.2/api/medication.php?op=create&encoding=json&passcode=x&firstname=Nicholas&lastname=Hall&address=123+Fake+St&state=WI&zipcode=53095&city=West+Bend"
{
   "gcapi": {
       "result": "SUCCESS",
       "medication": {
           "id": "93c2dc15-20b3-4884-81ca-6f57335a1bdb",
           "firstname": "Nicholas",
           "lastname": "Hall",
           "address": "123 Fake St",
           "city": "West Bend",
           "state": "WI",
           "zipcode": "53095",
           "homephone": " ",
           "workphone": " ",
           "cellphone": " ",
           "pager": " ",
           "email": " "
       }
   }
}

read

Reads a single medication or all medications

Parameters

  • id - [optional] - ID of specific medication to read. If left blank, reads all medications

Results

Returns SUCCESS and a single medication or all medications in the following format:

xml

<gcapi>
 <result>SUCCESS</result>
 <medication>
   <id>5f3e081d-e6af-4dd6-a6b8-dd4d8890e611</id>
   <firstname>Shirley</firstname>
   <lastname>Doe</lastname>
   <address>2412 West Washington Ave</address>
   <city>West Bend</city>
   <state>WI</state>
   <zipcode>53095</zipcode>
   <homephone>2623349394</homephone>
   <workphone>2623386147</workphone>
   <cellphone>2626896732</cellphone>
   <pager></pager>
   <email>shirley@grandcare.com</email>
 </medication>
</gcapi>

json

{
   "gcapi": {
       "result": "SUCCESS",
       "medication": [
           {
               "id": "5f3e081d-e6af-4dd6-a6b8-dd4d8890e611",
               "firstname": "Shirley",
               "lastname": "Doe",
               "address": "2412 West Washington Ave",
               "city": "West Bend",
               "state": "WI",
               "zipcode": "53095",
               "homephone": "2623349394",
               "workphone": "2623386147",
               "cellphone": "2626896732",
               "pager": "",
               "email": "shirley@grandcare.com"
           }
       ]
   }
}

update

Updates an existing medication

Parameters

  • id - [required] - ID of medication to update
  • firstname - [optional] - First name
  • lastname - [optional] - Last name
  • email - [optional] - Email address
  • address - [optional] - Street address
  • city - [optional] - City
  • state - [optional] - State
  • zip - [optional] - Zip code
  • homephone - [optional] - Home phone number
  • workphone - [optional] - Work phone number
  • cellphone - [optional] - Cell phone number
  • pager - [optional] - Pager phone number

Results

Returns SUCCESS and a copy of the newly updated medication if successful, otherwise FAILURE. See the #read method for more information on the returned medication object.

delete

Deletes an existing medication

Parameters

  • id - [required] - ID of medication to delete

Results

Returns SUCCESS if the medication is deleted, otherwise FAILURE.