{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"f45e41c1-ccfd-43ea-b06b-fa296af690ab","name":"Medhub API Specifications","description":"The MedHub API provides external systems with access to its database through pre-defined calls. The API is much like a standard REST interface, but with a couple of important differences.\n\nFirst, MedHub uses the HTTP method “POST” for all requests, using a Content-Type of `application/x-www-form-urlencoded`. This provides for complex requests and garners more familiarity and support than the often unused “PUT” method.\n\nSecond, MedHub employs a verification technique that is very similar to Amazon’s AWS authentication. This process is described in detail in the \"API Requirements\" section.\n\n# Requesting API Access\n\nEach institution manages access to the MedHub API through the GME Office. To request access, contact the project manager within the GME Office and provide the following information in your request.\n\nCompany/System Information:\n\n<ul><li><div>Company Name</div></li><li><div>System Name</div></li><li><div>System IP Addresses</div></li></ul>\n\nContact Information:\n\n<ul><li><div>Primary Contact</div></li><li><div>Contact Email Address</div></li><li><div>Contact Phone Number</div></li></ul>\n\nAccess Needs:\n\n<ul><li><div>Programs/Courses Needed</div></li><li><div>Calls Requested (see below for list of available calls)</div></li></ul>\n\nIf your request is approved, you will be provided with a `clientID` (integer) and a private key. These will be used to generate a verification key, which is needed for each API call. Keep the private key in a safe place and do not distribute.\n\n# API Requirements\n\nThis section will identify the interface requirements and process for making a call to the MedHub API. All calls should be made using HTTPS, to ensure encryption in transit.\n\nAll calls should use a standard POST request and include the following variables. The Content-Type of these requests should be set as `application/x-www-form-urlencoded`.\n\n<ul><li><div><code>clientID</code> - Your assigned client identifier (integer)</div></li><li><div><code>ts</code> - Current UNIX timestamp (must be within 10 minutes of MedHub server time). <i>Note: this timestamp should be provided in whole seconds (e.g. 1593030486 representing 6/24/2020 at 8:28pm UTC)</i></div></li><li><div><code>type</code> - This will identify the format type of the request and response. At this time, only “json” is supported.</div></li><li><div><code>request</code> - The JSON encoded request, which is specific to each call. <i>Note: this is not needed or optional for some calls.</i></div></li><li><div><code>verify</code> - The unique hash which is used to verify the authenticity of the request</div></li></ul>\n\nProcess used to generate the “verify” string.\n\n<ol><li><div>Concatenate a string with the following data, delimited with the pipe (“|”) character:<br></div><ol><li><div>clientID</div></li><li><div>timestamp</div></li><li><div>private key</div></li><li><div>request</div></li></ol><div><br><br>The string should look like this:<br><br><code>{clientID}</code>|<code>{timestamp}</code>|<code>{private key}</code>|<code>{request}</code><br><br><i>Note: the third pipe character is required even if the request is left blank.</i></div></li><li><div>Generate a SHA256 digest (keyless hash) of this information and send as the value of the <code>verify</code> key.</div></li></ol>\n\n# Error Codes\n\n<table><tbody><tr><th>Error Code</th><th>Error Description</th><th>Error Notes</th></tr><tr><td><div>S01</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Request was not well formed (missing class, method, verify string, or clientID)</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S02</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>IP Address not discoverable</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S03</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Invalid Client</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S04</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Inactive Client</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S05</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Client does not have access to call or this call has been deactivated</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S06</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Timestamp not within 10 minutes</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S07</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Verification string invalid</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>S08</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Invalid requesting IP Address</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Identify requesting IP address and ask GME Office to update profile</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>E01</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Invalid request (class/method not found)</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>E02</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Unsupported return type requested</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>E03</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Access denied to this program</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>E04</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Invalid request (unknown or malformed inputs)</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>None</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>E05</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Requested result set is too large</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>This error is displayed when the requested data set is too large. Thresholds are call-specific and should be provided in the documentation above. This error can often be avoided by adding additional filters (date range, etc)</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr></tbody></table>\n\n# HTTP Status Codes\n\n<table><tbody><tr><th>Status Code:</th><th>Code Description:</th><th>Notes:</th></tr><tr><td><div>200</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>OK</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>You should receive this code with any successful call.</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>400</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Bad Request</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>This code will be returned if an invalid return type is requested</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>401</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Unauthorized</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>This code will be received if there was a security/authorization-related error</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>403</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Forbidden</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>(currently unused)</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr><tr><td><div>404</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>Not Found</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td><td><div>This code identifies an unknown call</div><div contenteditable=\"false\"><div><div><div></div></div></div><div></div></div></td></tr></tbody></table>\n\n# Sample Interface Scripts\n\n```\n//Client-specific settings\n$clientID='1001';\n$institution='demo';\n$privateKey='pv93bfq12eps';\n//Sample call path\n$callPath='users/residents';\n//Get UNIX timestamp\n$timeNow=time();\n//Create request\n$requestA=array('programID'=>19);\n$request_json=json_encode($requestA);\n//Generate verification string\n$verifyStr=hash('sha256',$clientID.\"|\".$timeNow.\"|\".$privateKey.\"|\".$request_json);\n//Construct data to send\n$post_dataA=array(\n    'clientID'=>$clientID,\n    'ts'=>$timeNow,\n    'verify'=>$verifyStr,\n    'type'=>'json',\n    'request'=>$request_json);\n//Request URL\n$url='https://'.$institution.'.medhub.com/functions/api/'.$callPath;\n//Initialize cURL\n$ch=curl_init();\ncurl_setopt($ch, CURLOPT_URL, $url);\ncurl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_dataA));\n//Get response data and\n$responseStr=curl_exec($ch);\n$response_infoA=curl_getinfo($ch);\n//Close session\ncurl_close($ch);\n//Display response\necho \"HTTP Status Code: <strong class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27;>\".$response_infoA[&#x27;http_code&#x27;].\"</b><BR><BR>\";\necho \"<pre class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27;>\".htmlentities($responseStr).\"</pre>\";\necho \"<BR><BR><HR size=1><strong class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27;>JSON Decoded:</b><BR><BR>\";\necho &#x27;<div class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; class=&#x27;preserveHtml&#x27; style=\"font-family: monospace; white-space:pre;\">&#x27;;\necho htmlspecialchars(var_export(json_decode($responseStr,true)));\necho &#x27;</div>&#x27;;\n?>\n\n ```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"10092239","team":653815,"collectionId":"f45e41c1-ccfd-43ea-b06b-fa296af690ab","publishedId":"T17KbkzJ","public":true,"publicUrl":"https://api-docs.medhub.com","privateUrl":"https://go.postman.co/documentation/10092239-f45e41c1-ccfd-43ea-b06b-fa296af690ab","customColor":{"top-bar":"125488","right-sidebar":"303030","highlight":"5FA800"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.1","publishDate":"2020-07-08T12:34:12.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/c444a7cb3e4957ebca9cdf3fdcab73a291970ae0ca17f2276619ff89d4b717a2","favicon":"https://medhub.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://api-docs.medhub.com/view/metadata/T17KbkzJ"}