-
Notifications
You must be signed in to change notification settings - Fork 19
1. Getting Started
API credentials consist of a unique identifier and an SHA1 hash. The values must be passed in your requests via custom HTTP headers X-Developer-Id and X-Api-Key. These will be provided by SnapMD developers. You will begin with sandbox keys, and be provided with separate production keys when your app is approved.
Authentication in the API is handled through OAuth2 bearer token authentication. To retrieve a token, you POST a login resource to the API. Any activity on behalf of a user must use this method of authentication.
POST http://snap.local/api/v2/account/token HTTP/1.1
User-Agent: Fiddler
Host: snap.local
Content-Type: application/json
X-Developer-Id: ******
X-Api-Key: ******
{
'userTypeId': 1, // 1: patient/customer, 2: clinician/admin
'hospitalId' : 1,
'email' : <email>,
'password' : <password>
}
The response payload is
{
"data": [
{
"access_token": <token>
}
],
"total": 1
}
We have our version of Hello World to verify proper setup.
Request:
GET /api/hello HTTP/1.1
User-Agent: Fiddler
Host: snap.local
Content-Type: application/json
Authorization: Bearer ***********
X-Developer-Id: ******
X-Api-Key: ******
The value of "hello" is the username associated with the token; Response body:
{ "hello" : string }
Documentation for individual APIs can be found at https://sandbox.connectedcare.md/api/help