Subscriptions Management APIs

Subscriptions Management APIs allows external applications to get authorised and securely access the products and Healthcode. Subscriptions gives access to products and features of Healthcode’s product suite. These APIs are used to get the plans, roles and features provided by a plan and the features assigned to a site using subscriptions.

Product Group is an information system bundle that deals with a specific dataset – for e.g., Practice Management System, Clearing Services, PPR, etc.

Product: holds the information about services, functionalities or UI pages that can be subscribed as plans. A feature can be restricted to be visible to users by enabling the ‘displayforcheckout’ flag in the table. In this case, though the feature is selected in a plan, its not visible to the user.

Subscription Plans are the subscription plans that a client/site/user can subscribe to – for e.g., Basic, Lite, Pro for ePractice.

  • A Product Plan maps to  several Roles that one can perform by subscribing to the specific plan.
  • Management of Product Plans is handled centrally as part of the Subscription Management implementation.

  • A Product Group typically consists of one primary data-domain implementation and optionally one or more UI interfaces, each implementation forming a distinct Product. For e.g., the PPR product group consists of a PPR data-domain implementation that encapsulates the practitioner profiles data and exposes a number of APIs to operate on same, and separate UI implementations for Specialist View, Insurer View and Hospital View.
  • A given Product may offer multiple subscription options as defined by Product Plans.
  • Management of Product Groups and Products is handled centrally as part of the Subscription Management implementation.

Sites and Users can be assigned a set of Roles, typically from the subset depending on the subscription one has.

Product Features: are the primary and smallest building blocks of the access control mechanism. Features control access to the smallest logical operation, like viewing or updating specific section of a PPR profile.

Features are typically functional, like Manage Demographics, View Demographics and Manage Insurer Recognition features in this example. However, in some cases they can also be operational, like the Archive Old Profiles feature. Operational features can typically be used for creating operational Roles, which can then be assigned to a schedulable batch module that can use the access to perform the requisite housekeeping operations, say overnight.

Roles: represent distinct workflow or interfaces to which a client, site or user can be given access to – for e.g., Manage PPR Profile, View PPR Profile, Manage Insurer Recognition, etc.

  • Roles are a grouping of features which are granted by having the role.
  • Roles are logical blocks – so in effect, their structure can be altered without code change.
  • All features mapped to a Role are treated as a set, and either one has the grant to all features or none.
  • Set of features granted by roles are not mutually exclusive. Where a client/site/user has permission to multiple roles and a specific feature is removed from one role, the client/site/user may continue to have access to that feature if it was granted by another one of their roles.

Introspect API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/introspect' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 
--header 'SU-UserId: 00GO413E' 
--header 'SU-SiteId: HC02006' 

Where,

Header FieldTypeMandatory/ OptionalDescription
SU-UserIdStringOUser to which the sudo needs to be done
SU-SiteIdStringOSiteId that needs to be switched to

The API does not accept any specific parameters and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

If SU-SiteId HTTP header was supplied, the API verifies the current logged in user has access to the specific site. If SU-UserId HTTP header was supplied, and the value is different to the user-id value supplied in the auth token, the API first verifies the logged-in user has the Sudoer role assigned. And also checks the UserId supplied in the header has access to the SiteId supplied by SU-SiteId parameter (in turn proving the target account is in scope for the logged in user to switch to).

If all verifications succeed, the API returns HTTP 200 status back along with a response body of,

{
    "status": "success"
}

If any verification fails, the API returns HTTP 401 Unauthorized status back and must indicate an error in the response body as,
{
    “error”: “invalid_site_or_user”,
    “error_description: “The site/user authorisation was invalid”
}

List Features API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/feature' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 
--header 'SU-UserId: 00GO413E' 
--header 'SU-SiteId: HC02006' 

Where,

FieldType Mandatory/OptionalDescription
product-group-idStringOproduct group for which the features needs
to be fetched
Header FieldTypeMandatory/ OptionalDescription
SU-UserIdStringOUser to which the sudo needs to be done
SU-SiteIdStringOSiteId that needs to be switched to

The API does not accept any specific parameters and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

The API returns the list of roles and the features associated within each role with id ,name and other fields.

If SU-SiteId and/or SU-UserId HTTP headers were supplied, the returned list is derived based on the supplied SiteId/UserId combination.

If the SU-SiteId/SU-UserId headers were not supplied, the return list is derived using user details from the supplied auth token.

And if product-group-id was supplied in request parameter, the returned list is limited to the provided product-group-id.

[
    {
        "roleId": "GenericLoginFunctions",
        "code": "GenericLoginFunctions",
        "name": "Generic Login Functions (Public)",
        "status": "active",
        "features": [
            {
                "id": "Login v1.0",
                "name": "Login v1.0",
                "code": "Login_1_0",
                "identifier": "Login_1_0",
                "description": "Allows a user to login with a valid login account ",
                "status": "active"
            },
            {
                "id": "Reset Password v1.0",
                "name": "Reset Password v1.0",
                "code": "ResetPassword_1_0",
                "identifier": "ResetPassword_1_0",
                "description": "Allows a user to reset their password",
                "status": "active"
            },
            {
                "id": "Logout v1.0",
                "name": "Logout v1.0",
                "code": "Logout_1_0",
                "identifier": "Logout_1_0",
                "description": "Allows a user to logout and end their session",
                "status": "active"
            }
        ],
        "clientassignable": false,
        "siteassignable": false,
        "userassignable": false,
        "accountmanagerassignable": false,
        "publicaccess": true,
        "productGroup": {
            "id": "PGwTCEK7",
            "name": "SSO and Subscriptions Management",
            "identifier": "SUBSCRIPTION",
            "description": "central subscription management PRODUCT GROUP"
        }
    },
    {
        "roleId": "OrganisationAccountManager",
        "code": "OrganisationAccountManager",
        "name": "Organisation Account Manager",
        "status": "active",
        "features": [
            {
                "id": "Edit Account Details v1.0",
                "name": "Edit Account Details v1.0",
                "code": "EditAccountDetails_1_0",
                "identifier": "EditAccountDetails_1_0",
                "description": "Allows a user to edit details of accounts they have access to, and where they are assigned as an account manager",
                "status": "active"
            }
        ],
        "clientassignable": false,
        "siteassignable": false,
        "userassignable": false,
        "accountmanagerassignable": true,
        "publicaccess": false,
        "productGroup": {
            "id": "PGwTCEK7",
            "name": "SSO and Subscriptions Management",
            "identifier": "SUBSCRIPTION",
            "description": "central subscription management PRODUCT GROUP"
        }
    }
]

List Subscription Plans API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/plan/{product-group-id}' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 

Where,

Header FieldMandatory/OptionalDescription
product-group-idMproduct group for which the features needs to be fetched
SU-UserIdOUser to which the sudo needs to be done
SU-SiteIdOSiteId that needs to be switched to

The API does not accept any specific parameters and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

The API returns the list of Subscription Plan records with id and name fields. If SU-SiteId HTTP header was supplied, the returned list must be derived based on the supplied SiteId.

And if the SU-SiteId header was not supplied, the return list must be derived using site details from the supplied auth token.

[
    {
        "id": "2019032615075560400003470",
        "identifier": "epractice-lite",
        "name": "ePractice Lite",
        "requiresPayment": true,
        "description": "An entry-level integrated online financial toolkit.",
        "logo_url": "",
        "type": "",
        "category": "SP",
        "slab": "5",
        "price": "2099.00",
        "billingperiod": "MONTH",
        "currency": "GBP",
        "businesspackage": "",
        "bespoke": true,
        "defaultproduct": {
            "id": "PDWzs4oG",
            "name": "ePractice",
            "identifier": "EPRACTICE",
            "description": "ePractice",
            "homeurl": "https://epractice.dev.healthcode.co.uk/postauth",
            "logourl": {LOGO_URL},
            "productGroupId": "PGDo5Yfo"
        },
        "roles": []
    }
]

Where,

FieldTypeDescription
idStringPlan ID
identifierStringCode or identifier for the plan
nameStringPlan name
requiresPayment booleanboolean value whether payment is required for this plan
description String Plan description
logo_url String Plan URL if available
type String plan type { usually API or UI}
category String plan category specifying the type of users that the plan can be used
slab String plan feature level
price String price of the plan
billing period String billing period of the plan
currency String currency of the price
businesspackage String bundle identifier of the plan
defaultproduct String default product that this plan belongs to
roles String roles and features that the plan has

List Roles API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/role?productGroupId=<product-group-id>' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 

Where,

Header FieldMandatory/OptionalDescription
product-group-idMproduct group for which the features needs to be fetched
SU-UserIdOUser to which the sudo needs to be done
SU-SiteIdOSiteId that needs to be switched to

The API does not accept any specific parameters and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

The API returns the list of role records with id and name fields. If SU-SiteId HTTP header was supplied, the returned list must be derived based on the supplied SiteId.

And if the SU-SiteId header was not supplied, the return list must be derived using site details from the supplied auth token.

[
    {
        "roleId": "OrganisationAccountManager",
        "code": "OrganisationAccountManager",
        "name": "Organisation Account Manager",
        "status": "active",
        "features": [],
        "clientassignable": false,
        "siteassignable": false,
        "userassignable": false,
        "accountmanagerassignable": true,
        "publicaccess": false,
        "productGroup": {
            "id": "PGwTCEK7",
            "name": "SSO and Subscriptions Management",
            "identifier": "SUBSCRIPTION",
            "description": "central subscription management PRODUCT GROUP"
        }
    },
    {
        "roleId": "AccountUserSelfServe",
        "code": "AccountUserSelfServe",
        "name": "Account & User Self-Serve",
        "status": "active",
        "features": [],
        "clientassignable": false,
        "siteassignable": false,
        "userassignable": false,
        "accountmanagerassignable": false,
        "publicaccess": true,
        "productGroup": {
            "id": "PGwTCEK7",
            "name": "SSO and Subscriptions Management",
            "identifier": "SUBSCRIPTION",
            "description": "central subscription management PRODUCT GROUP"
        }
    },
    {
        "roleId": "GenericLoginFunctions",
        "code": "GenericLoginFunctions",
        "name": "Generic Login Functions (Public)",
        "status": "active",
        "features": [],
        "clientassignable": false,
        "siteassignable": false,
        "userassignable": false,
        "accountmanagerassignable": false,
        "publicaccess": true,
        "productGroup": {
            "id": "PGwTCEK7",
            "name": "SSO and Subscriptions Management",
            "identifier": "SUBSCRIPTION",
            "description": "central subscription management PRODUCT GROUP"
        }
    }
]

Where,

FieldTypeDescription
roleIdStringRole ID
codeStringCode or identifier for the role
nameStringRole name
status booleanstatus of the role
defaultproduct String default product that this role belongs to

Get User Info API

REQUEST

curl --location --request GET 'https://accounts.dev.healthcode.co.uk/api/userinfo?
code=3PWqF40zaKcU3t9vZF4APpotS' 
--header 'Content-Type: application/json' 
--header 'Authorization: Bearer {{AccessToken}}' 
--data-raw ''

Where,

Request ParameterMandatory/OptionalDescription
codeMCode to retrieve the user site’s selection

The API accepts ‘code’ request parameter using which the user and site info is fetched. This API is called by an application when its being redirected by central subscription portal to know the user selected site in subscription portal to redirect to the application. Site selected by user is important for the target application to take the user to the selected site pages. The target application has to read ‘sitecode’ URL parameter when its being redirected and use that as ‘code’ parameter to call this API. This API takes the ‘code’ parameter and returns the user and site info.

The calling system needs to get the token from the SSO server using client credentials and then call this API by passing token in header.

RESPONSE PROCESSING

The API returns the record with user and site info selected in products and subscription page.

{
    "user": {
        "id": "011YX1CF3",
        "title": "Master",
        "family": "Lara ",
        "given": "Jero new",
        "loginEmailAddress": "epuser4@dispostable.com",
        "roles": [],
        "creationdate": "2021-07-29 12:34:24",
        "lastupdatedon": "2022-07-19 15:53:31"
    },
    "site": {
        "id": "HC011YX",
        "name": "Nicholls Lambo [SP051472]",
        "type": "p",
        "users": [],
        "roles": []
    }
}

Where,

FieldTypeDescription
userStringlogged-in User record
siteStringsite selected by the user

Get User Control Parameters API

REQUEST

curl --location --request GET 'https://accounts.dev.healthcode.co.uk/api/user$control-parameters' 
--header 'Content-Type: application/json' 
--header 'Authorization: Bearer {{AccessToken}}' 
--data-raw ''

Where,

Header FieldMandatory/OptionalDescription
SU-UserIdOUser to which the sudo needs to be done
SU-SiteIdOSiteId that needs to be switched to

The API does not accept any specific parameters and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

The API returns flags indicating whether the user can perform switch-site and switch-user operations, using the user identifier from the authorization token

{
    "status": "success",
    "switchUser": "false",
    "switchSite": "true"
}

Where,

FieldTypeDescription
statusStringStatus
switchUserStringswitch-user flag
switchSiteStringswitch-site flag

List Child Sites API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/site?parentId=<site-id>' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 

Where,

Request ParameterMandatory/OptionalDescription
parentIdMParent Site ID

The API accepts ‘parentId’ request parameter using which the list of site info is fetched and accepts authorization header with site/user credentials as basic authentication. Additionally, as mentioned above the API accepts SU-UserId and SU-SiteId as optional headers to validate the authorizations for the site and user switch operations in the calling application.

RESPONSE PROCESSING

The API returns the list of site records with id and name fields of child sites of the parent-id supplied as input.

[
    {
        "id": "MS5494A",
        "name": "Test MedSec Site 2",
        "identifier": "MS5494A",
        "description": "MS5494A migrated from Veda",
        "account": {
            "id": "HACBABUE",
            "bankdetails": [],
            "users": [],
            "sites": [],
            "identifiers": []
        },
        "status": "ACTIVE",
        "type": "m",
        "users": [],
        "roles": [],
        "parentsite": {
            "id": "HCODE",
            "users": [],
            "roles": []
        }
    },
    {
        "id": "NUFF",
        "name": "Nuffield Hospital Group",
        "identifier": "NUFF",
        "description": "NUFF migrated from Veda",
        "account": {
            "id": "HA27E9A0",
            "bankdetails": [],
            "users": [],
            "sites": [],
            "identifiers": []
        },
        "status": "ACTIVE",
        "type": "g",
        "users": [],
        "roles": [],
        "parentsite": {
            "id": "HCODE",
            "users": [],
            "roles": []
        }
    }
]

Where,

FieldTypeDescription
idStringSite ID
nameStringSite Name
descriptionStringSite Description
status BooleanSite Status
account String Account linked to the Site

List Authorised Sites API

REQUEST

curl --request GET 
--url 'https://accounts.dev.healthcode.co.uk/api/site/authorized' 
--header 'Authorization: Bearer abCdE12...89mNopq0r' 
--header 'Content-Type: application/json' 

The API does not accept any specific parameters and accepts authorisation header with user credentials as basic authentication.

RESPONSE PROCESSING

This API returns a list of sites the logged in user is authorised to access. The User ID will be retrieved from the access token.

[
    {
        "id": "HC00G12",
        "name": "Lourdes Hospital",
        "identifier": "HC00G12",
        "status": "ACTIVE",
        "type": "p"
     
    },
    {
        "id": "HC00GN1",
        "name": "GMS Nicky Kingsmill",
        "identifier": "HC00GN1",
        "status": "ACTIVE",
        "type": "m"
    },
    {
        "id": "HC00GOC",
        "name": "Paul Davies Medical Secretary Site 20050919",
        "identifier": "HC00GOC",
        "status": "ACTIVE",
        "type": "m"
    }
   
   
]

Where,

FieldTypeDescription
idStringSite ID
nameStringSite Name
descriptionStringSite Description
statusBooleanSite Status
type String Site Type (code)

Below are the site type codes
c = Practice
g = Group
h = Healthcode
i = Insurer
m = Medical Secretary
p = Provider
s = Practitioner
t = Hospital