Overview:

API resources are protected by the CareCloud authorization server, which implements the SMART App Launch Framework 2.0.0 (OAuth 2.0 and OpenID Connect). Applications are registered in the Developer Portal; after the user signs in and authorizes the application, the server issues an access token for the FHIR API.

Authorization server

To access APIs, you will:

  1. Register a developer portal account
  2. Login in to Developer Portal
  3. Create an application
  4. Generate an authorization code
  5. Generate an access token
  6. Consume token to access APIs

If you already have a developer portal account and registered an application, go right to Dev Center and Login.

Creating a Developer Portal Account

  1. Navigate to Dev Center
  2. Click on Register and then add the information as shown in step 3.
  3. not found
    not found
  4. Enter the following details to create an account:
    • Care Cloud: Select application Care Cloud, MTBC or Meridian
    • First Name: Enter your first name.
    • Last Name: Enter your last name.
    • Display Name: Enter the name that will be displayed for your account.
    • Password: Enter the password.
  5. Select Register to create your new developer portal account.
    • You will view successful account creation popup.

Login in to Developer Portal

Overview: During this procedure, you will understand the procedures necessary to login in to the Developer Portal.

Log in to Developer Portal

  1. Navigate to the Dev Center.
  2. Enter the username used to create your account. For example, john.doe@gmail.com.
  3. Enter the password used to create your account.
  4. Select the Log in button and the Developer Portal screen is displayed.

Note: Your display name should now appear in the top right corner of the screen.

Create an application

During this procedure you will use Developer Portal to create a new application.

not found
  1. Select Add New App widget and the Register New App screen appears.
  2. not found
  3. Enter the following details to create your new application:
  4. App Type: Select the App Type from one of these options. (1-Stand Alone, 2- Multi Patient & 3-EHR
  5. Note: Selecting Multipatient from App Type will show an additional field JSON WEB Key Set as shown in given below image.

    not found
  6. App Name & Version: Enter the name of your application. For example CareApp 1.0.0
    • Type of Access: Select the Type of Access from one of these options.(1-Online, 2-Offline)
    • App Privacy: Select the App privacy type from one of these options (1-Public. 2-Confidential)
    • Redirect URLs: A redirect URL is the location (URL) where the client is sent after successful account authentication. Example: Your redirect URL is https://httpbin.org/anything. When you successfully log in to the system, your user credentials are authenticated, and a response is sent back to the redirect URL. The header of the response carries the authorization code that can then be used in obtaining an access token (see section below).
    • Note: The authorization server sends the authorization code only to a redirect URL registered here. Your application exchanges the code for an access token, which it then uses to call the API.
    • SMART Launch URLs (Optional):Enter the SMART URL for your application.
    • Select the Submit button.
  7. The My App page displays the newly added application with the given below information
  8. Client ID and Client Secret displayed; these will be required later to access the APIs and place the API call.

    not found
  9. Copy the Client ID value and paste it into a text document.
  10. Note: This value will be required when constructing the Access My Data URL and generating the access token.

  11. Select the Copy icon above the Client Secret to copy this value to the dashboard and paste it into a text document for future use.
  12. Note: This value will be required when generating the access token.

  13. IMPORTANT: Select the Close button and the application displays in the My applications screen.

Generating the Authorization Code

Note: The Client ID and Client Secret Key & Redirect URL used to access patient resources with new developed application setup. If the Client ID and Client Secret Key matches with the assigned one then the given below screen will appear.

  1. The Patient Access screen displayed.
  2. not found
  3. Enter one or more of the available search parameters:
    1. First Name: Searches for patients by the entered first name.
    2. Last Name: Searches for patients by the entered last name.
    3. Date of Birth: Searches for patients by the entered or selected birth date.
    4. Patient ID: Searches for patients by the entered patient ID.
  4. Select the Submit button to display a list of all patients matching the entered search parameters.
  5. Note: You may simply select the Submit button to display a list of all patients.

  6. Select a Patient Check box button next to a patient to be accessed and click on Authorize button.
  7. This adds a URI for the selected patient and displays the patient’s authorization code.

    not found
    not found

    IMPORTANT:
    Note: The above sample call to the authorize endpoint requests an access token for a specific patient context by specifying the OAuth2 scopes for patient context (for example patient/*.read or patient/*.rs, and launch/patient), together with a PKCE code_challenge (S256). These scopes will prompt you to select a patient. If you do not want to establish a patient context with your access token, then you may use other scopes that are available as part of the SMART® on FHIR® standard. See Scopes and Launch Context on the SMART® technical documentation website.

    Copy the patient’s authorization code into a text document for later reference.

Generating Access Token

Now you are ready to make API calls. The following section provides several sample calls in Postman to illustrate how different APIs can be invoked.

First, we will use the authorization code generated for a specific patient to generate an access token. An Access token is the secure key used to read the patient records.

Before you start

Locate the following required variables:

Generate an access token

  1. Open Postman, create a blank tab and the Untitled Request screen is displayed.
  2. not found
  3. Select POST.
  4. Enter this URL
  5. not found

    into the Request URL field

  6. Select the Authorization tab then enter the following into the Authorization screen:
    • Select Basic Auth from the Type drop-down field.
    • Copy the client ID generated when you created the application in Developer Portal and paste it into the Username field.
    • Copy the client secret generated when you created the application in Developer Portal and paste it into the Password field.
  7. Select the Body tab and the Body screen is displayed.
  8. not found
  1. Select the x-www-form-urlencoded radio button and add the following keys and values into the body of the POST request:
  2. No. Key Value
    a. grant_type authorization_code
    b. redirect_uri <redirect URL entered when the application was created in Developer Portal >
    c. code: <authorization code (Patient or Provider) from previous step >
    d. code_verifier <the PKCE code verifier whose S256 hash was sent as code_challenge in the authorize request >
  3. Select the Send button and the access_token is generated
  4. Copy the access_token and patient_id to a text document for later use.
  5. not found

Accessing APIs

During this procedure, you will configure Postman using the access_token and patient_id to access APIs and view patient information.

Before you start

Locate the following required variables:

Consume token to access APIs

  1. Create a new tab within Postman.
  2. Select GET.
  3. Enter the following address into the Request URL field:
    not found

    patientid=<patientidvalue> and replace <patientidvalue> with the patient_id copied in the previous procedure.

    not found

    patientid=1000000000048701

  4. Select the Headers tab.
  5. not found
  6. Add a new key named Authorization with a value of Bearer <access_token>
  7. Select the Send button.
  8. The requested FHIR resource (a Bundle of the patient’s records) is returned, showing the patient’s data can now be accessed via the API.
  9. not found

Troubleshooting

User session not found. User must re-authenticate.

not found

This error indicates the sign-in session has timed out or the authorization code has already been used or has expired (an authorization code can be exchanged only once).

To resolve this issue, you must re-generate the authorization code, replace the previous code value within Postman with this new code and select the Send button to successfully generate the access token.