Difference between revisions of "Internal GCAPI"

From GrandCare Systems
Jump to navigation Jump to search
Line 19: Line 19:
* gcapi->result will be "SUCCESS" or "FAILURE"
* gcapi->result will be "SUCCESS" or "FAILURE"
** In case of FAILURE, there will also be a key "fail-message" describing the failure.
** In case of FAILURE, there will also be a key "fail-message" describing the failure.
** See [[#Failure examples|Examples]]
== History API ==
== History API ==
* URL: $SystemAddress/api/history.php
* URL: $SystemAddress/api/history.php
Line 134: Line 135:
* URL: $SystemAddress/api/system.php
* URL: $SystemAddress/api/system.php


= Failure examples =
Wrong Passcode
{
    "gcapi": {
        "result": "FAILURE",
        "fail-message": "Invalid credentials for API call"
    }
}
Invalid Operation
{
    "gcapi": {
        "result": "FAILURE",
        "fail-message": "Invalid operation for API call"
    }
}
Missing Required Parameter
{
    "gcapi": {
        "result": "FAILURE",
        "fail-message": "Missing required parameter 'logfile'"
    }
}
= Other Resources =
= Other Resources =
* [https://github.com/ngharo/gc-javascript-api Experimental JavaScript library]
* [https://github.com/ngharo/gc-javascript-api Experimental JavaScript library]

Revision as of 18:56, 1 August 2012

To access the Como API you first need the passcodes to the system via GCManage API.

If you're on the same network as the GrandCare system, you can call directly to it's IP address. If not, you'll need to get the public URL from the GCManage API remotelogin service.

This URL (whether private IP or public address) will be referenced as $SystemAddress in the rest of the documentation.

$SystemAddress Examples

http://gcmanage.grandcare.com:21000
http://192.168.0.5
http://10.100.1.5

Services

  • Global Parameters
    • op: API Operation (see list below)
    • encoding ("json" or "xml")
    • passcode: System passcode from GCManage API. Note: passcodes are not static.
  • Use GET or POST requests
  • Returns data with the namespace gcapi
  • gcapi->result will be "SUCCESS" or "FAILURE"
    • In case of FAILURE, there will also be a key "fail-message" describing the failure.
    • See Examples

History API

  • URL: $SystemAddress/api/history.php

bp (Blood Pressure)

$ curl "http://10.100.1.2/api/history.php?op=bp&encoding=json&passcode=YkdrYUpUOEVVRDhMZFQ4SlB6OC9kdz09"
{
   "gcapi": {
       "result": "SUCCESS",
       "bp": [
           {
               "timestamp": "07/31/12 08:15:57",
               "deviceId": "1001",
               "residentId": "cf6ff892-3124-41ef-8c77-e729f0f66fc5",
               "systolic": "134",
               "diastolic": "95",
               "pulse": "54",
               "mean-ap": "117"
           },
           {
               "timestamp": "07/28/12 07:51:16",
               "deviceId": "1001",
               "residentId": "cf6ff892-3124-41ef-8c77-e729f0f66fc5",
               "systolic": "134",
               "diastolic": "89",
               "pulse": "51",
               "mean-ap": "104"
           }
       ],
       "totalEntries": "2"
   }
}

weight

$ curl "http://10.100.1.2/api/history.php?op=weight&encoding=json&passcode=YkdrYUpUOEVVRDhMZFQ4SlB6OC9kdz09"
{
   "gcapi": {
       "result": "SUCCESS",
       "weight": [
           {
               "timestamp": "07/31/12 08:14:45",
               "deviceId": "1000",
               "residentId": "cf6ff892-3124-41ef-8c77-e729f0f66fc5",
               "value": "176.6"
           },
           {
               "timestamp": "07/28/12 07:49:32",
               "deviceId": "1000",
               "residentId": "cf6ff892-3124-41ef-8c77-e729f0f66fc5",
               "value": "176.2"
           }
       ],
       "totalEntries": "2"
   }
}

temp (Indoor Temperature)

$ curl "http://10.100.1.2/api/history.php?op=temp&encoding=json&passcode=YkdrYUpUOEVVRDhMZFQ4SlB6OC9kdz09"
{
   "gcapi": {
       "result": "SUCCESS",
       "temp": [
           {
               "timestamp": "07/20/12 12:06:18",
               "deviceId": "103",
               "value": "73"
           },
           {
               "timestamp": "07/20/12 11:53:14",
               "deviceId": "103",
               "value": "74"
           }
       ],
       "totalEntries": "2"
   }
}

Assign API

  • URL: $SystemAddress/api/assign.php

Caregiver API

  • URL: $SystemAddress/api/caregiver.php

Care note API

  • URL: $SystemAddress/api/carenote.php

Configure API

  • URL: $SystemAddress/api/configure.php

Device API

  • URL: $SystemAddress/api/device.php

Log API

  • URL: $SystemAddress/api/log.php

Media API

  • URL: $SystemAddress/api/media.php

Medication API

  • URL: $SystemAddress/api/medication.php

Message API

  • URL: $SystemAddress/api/message.php

PIN API

  • URL: $SystemAddress/api/pin.php

Resident API

  • URL: $SystemAddress/api/resident.php

Rule API

  • URL: $SystemAddress/api/rule.php

System API

  • URL: $SystemAddress/api/system.php

Failure examples

Wrong Passcode

{
   "gcapi": {
       "result": "FAILURE",
       "fail-message": "Invalid credentials for API call"
   }
}
Invalid Operation

{
   "gcapi": {
       "result": "FAILURE",
       "fail-message": "Invalid operation for API call"
   }
}
Missing Required Parameter

{
   "gcapi": {
       "result": "FAILURE",
       "fail-message": "Missing required parameter 'logfile'"
   }
}

Other Resources