API Overview and Documentation

The technology team at Magnus Health has developed a robust application programming interface (API) that facilities interaction between your school’s information system and Magnus Health. Schools that are already using a student information system can take advantage of having a single sign-on (SSO) integration with Magnus Health’s web-based, student medical record (SMR) solution. This integration saves time for school administrators and parents by bringing their student health records online and reporting back to the school when certain pieces of information are missing. Additionally, Magnus Health has developed several reporting functions that allow your system to pull raw and aggregate data back from the Magnus Health system.

The API requires a minimal amount of data on your users to set up this integration. Simply provide the first name, last name, phone number, email address, date of birth, and customer ID or vendor key (unique student identifier from your student information system) and the API authenticates those users into their Magnus Health account. No additional usernames, passwords, or URLs are needed. SSO reduces password fatigue among users and decreases the amount of password-related phone calls to your IT department. Users also feel more secure that they are being directed to the portal directly from the school’s website.

Magnus Health exposes several reporting functions via the API. The first function returns aggregated information about the total number of students complete and for those incomplete, their progress at that time. The other function identifies, for a given student, their current status in the system, if they’ve completed all their requirements, and their progress toward completing those requirements.

 

API Resources

API Account Setup

In order to get access to our Single Sign On services and API you will need to request access. Once you’re approved you will be assigned a Client ID that will uniquely identify your partner site within our system.

Please login to view more information



API Authentication

Magnus Health’s API implements a two-phase security system that ensures that user identifiable information is never sent across an insecure medium unencrypted. All calls within the API follow the same consistent pattern.

Please login to view more information



Secure Token Link

After obtaining the Secure Token via an API call, the partner site will then need to redirect the user to the following URLs:

Please login to view

A unique Secure Token link is generated after every call to the API. This link will be live for a configurable period of time. The system default is ten minutes. After this time period, the Secure Token expires.



Single Sign On Test Environment

Our current test setup is to use our “demo” system which will contain your test client ID and encryption key. Simply change your URL to point at:

Please login to view



Production Environment

Our current production setup uses the URL:

Please login to view



Glossary
API – (Application Programmer Interface)

SSO – (Single Sign On)

JSON – (JavaScript Object Notation)

Tracker– is the default segmentation for users. This is usually the class graduating or enrolling years.

Secure Token – a token that is assigned via an API call that will allow a user to seamlessly login to the site. This token is good for a pre-configured period of time after it is assigned. The default is 10 minutes. This token is 32 alphanumeric case sensitive characters.

Methods


JSON parses based on commas, apostrophes, and semicolons, make sure to escape all input with a back-slash before sending it.

CreateUser METHOD
The “user” call is the one-stop shop for the SSO API. Create User will perform one of two operations. The call will either provision the user, if the specified vendor key has never been provided before, and will return a new Secure Token to enable SSO, or if the vendor key has been used before and matches up against an existing user in our system, then the information provided will be ignored and the call will simply return a new Secure Token. Do not call this method on administrative accounts (such as school or corporate accounts).

If the user was not assigned an account token in the past, due to the fact that they were an organic sign up, your call to CreateUser will generate a new account token for that user and return it.

JSON parameters:

String username: suggested username, if this username is not available and the vendorKey does not exist in the system this call will create a user with a username = username+’x’ where x is the next available digit.

String vendorKey: a unique identifier for this user in your partner system, it must be passed along in every API call, and if this number does not match any found in the system then a new user will be created.

String firstName : the first name of the user.

String lastName: the last name of the user.

String phone: the phone number of the user.

String email: the email address of the user.

[Deprecated] Long dateOfBirth: a long representing the date of birth of the user (use CDT)

String dateOfBirthString: a static format string to be used as the date of birth instead of dateOfBirth, if dateOfBirthString is specified, then Long dateOfBirth is ignored. The date format should be in “mm/dd/yyyy”.

Long expirationDate: the date that this membership should expire, typically a year from the current date. If no expirationDate value is passed the system default for that customer will be used.

String registrationCode: the package code to be used in generating the new account

String nonce: a random value that is assigned for this particular call. We recommend but do not require that this be the current timestamp in a long. DO NOT REPEAT THIS VALUE. This value is used to stop replay/split header injection attacks. If a nonce value is repeated then the system will simply return an error code.

Return:

Secure Token: used to perform SSO. This secure token may only be used once to login after that it is deactivated.

Account Token: String unique value that represents a user on the Magnus Health site.

Username: String the unique value that the API picked for your user’s username.

Example
JSON Sent:

{“username”:”amagnus”, “vendorKey”: “Azy834Itlw0”, “firstName”:”Albert”, ”lastName”:”Magnus”,”phone”:”919-599-2917”, ”email”:”albert.magnus@magnushealthportal.com”, ”dateOfBirth”: 259445405250, ”registrationCode”:”MHP123456”, ”nonce”:”267445405250”}

Returns:

{“secureToken”:” ea5FqaS0eZnoty62XYVmSUej0frTX0UP”, “accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “username”:“amagnus”}



SecureToken METHOD
This method will return a Secure Token given the vendor key for a user. You may call this method on any user within Magnus Health that is associated with your reseller account. Please note that a Secure Token may only be used once and will timeout ten minutes after it is issued by default.

JSON Parameters:

String accountToken: the account token that was passed back from the CreateUser method.

String vendorKey: the partner’s unique vendor key that is used to double check the values.

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Returns:

String secureToken: a unique string that will allow the user access to the site

Example
JSON Sent:

{“accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “vendorKey”:”Azy834Itlw0”, “nonce”:”267446780000”}

Returns:

{“secureToken”:”ea5FqaS0eZnoty62XYVmSUej0frTX0UP”}



SetTracker METHOD
After the API has been used to successfully create a user, you have the ability to set the tracker for that user. If the user logs into Magnus Health before this is set, they will be prompted to select their tracker. This method will return a simple boolean to state whether the call succeeded.

JSON Parameters:

String accountToken: the account token that was passed back from the CreateUser method.

String vendorKey: the partner’s unique vendor key that is used to double check the values.

String nonce: unique value that is passed along to every API call that prevents replay attacks.

String trackerName: the name of the tracker you are trying to set the user on. This needs to be an exact match to the tracker name in the Magnus Health secure website.

String code: the registration code (package code) that the user is on

Returns:

boolean setSuccessfully: true if the tracker was set without errors

Example
JSON Sent:

{“accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “vendorKey”:”Azy834Itlw0”, “nonce”:”267446780000”, “code”:”AB12MH”, “trackerName”:”Class of 2012″}

Returns:

{“setSuccessfully”:”true”}



setMembershipStatus METHOD
This call allows Magnus Health integration partners to change the membership status for users in their account. In practice this allows partners to automatically archive (“remove”) users from counts and reports when the user has been removed from the partner’s system. This is often used after users have graduated or have withdrawn. If this call is a duplicate, meaning that your request should “archive” an individual who is already archived, the system will simply return success and make no changes.

JSON Parameters:

String accountToken: the account token that was passed back from the CreateUser method.

String vendorKey: the partner’s unique vendor key that is used to double check the values.

String code: the registration code (package code) that the user is on

String status: either “archive” or “active” the status that you want to change the specified user to

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Returns:

String status: “active” if the user is active in the system or “archive” if the user has been archived.

Example
JSON Sent:

{“accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “vendorKey”:”Azy834Itlw0”, “code”:”AB12MH”, “status”:”active”,“nonce”:”267445550000”}

Returns:

{“status”:”success”}



getMembershipStatus METHOD
This call will return back the status of the given user, if the user is archived or active. If a user is archived, they will receive no email updates and may not be permitted to login to the Magnus Health system.

JSON Parameters:

String accountToken: the account token that was passed back from the CreateUser method.

String vendorKey: the partner’s unique vendor key that is used to double check the values.

String code: the registration code (package code) that the user is on

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Returns:

String status: “active” if the user is active in the system or “archive” if the user has been archived.

Example
JSON Sent:

{“accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “vendorKey”:”Azy834Itlw0”, “nonce”:”267445550000”, “code”:”AB12MH”}

Returns:

{“status”:”active”}



getPackageCounts METHOD
This method returns a listing of users that are on the given account package/registration code. This call doesn’t return users that were on this package code but have been archived off.

JSON Parameters:

String code: the registration code (package code) that you would like to query

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Returns:

An array of rows, one row per data owner:

String vendorkey: vendor defined identifier

Integer numComplete: number of items completed.

Integer numItems: number of items total to complete.

Boolean complete: true if all requirements are complete and everything is reviewed, false otherwise.

String trackerName: the name of the tracker (e.g. Graduating Class of 2013)

Boolean userComplete: true if the student has filled out all requirements, false otherwise.

Example
JSON Sent:

{“code”:”AB12MH”, “nonce”:”266445505390”}

Returns:

{“packageDetails”:[{“vendorKey”:”78222000”,”numComplete”:6,”numItems”:8, “complete”:false, “trackerName”:”Class of 2012”, “userComplete”: false}, {“vendorKey”:”78222100”,”numComplete”:8,”numItems”:8, “complete”:true, “trackerName”:”Class of 2014”, “userComplete”: false},
{“vendorKey”:”78222003”,”numComplete”:0,”numItems”:0, “complete”:false, “trackerName”:”None Selected”, “userComplete”: false} ] }



getPackageCountsSince METHOD
Returns a listing of users that are on the given account package code whose account status has changed since the given delta date. This call doesn’t return users that were on this package code but were archived off.

JSON Parameters:

String code: the registration code (package code) that you would like to query

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Long deltaStartDate: a long representing the date to start looking for the delta of users who have had their status change. This could be they have newly answered requirements, changed answers, or something was reviewed. (use CDT)

Returns:

An array of rows, one row per data owner:

String vendorkey: vendor defined identifier

Integer numComplete: number of items completed.

Integer numItems: number of items total to complete.

Boolean complete: true if all requirements are complete and everything is reviewed, false otherwise.

String trackerName: the name of the tracker (e.g. Graduating Class of 2013)

Boolean userComplete: true if the student has filled out all requirements, false otherwise.

Example
JSON Sent:

{“code”:”AB12MH”, “nonce”:”266445505390”, “deltaStartDate”: 1319498044338 }

Returns:

{“packageDetails”:[{“vendorKey”:”78222000”,”numComplete”:6,”numItems”:8, “complete”:false, “trackerName”:”Class of 2012”, “userComplete”: false}, {“vendorKey”:”78222100”,”numComplete”:8,”numItems”:8, “complete”:true, “trackerName”:”Class of 2014”, “userComplete”: true}, {“vendorKey”:”78222003”,”numComplete”:0,”numItems”:0, “complete”:false, “trackerName”:”None Selected”, “userComplete”: false} ] }



getUser METHOD

This method returns detailed information about a given user on a specific package.

JSON Parameters

String accountToken: an encrypted form of the account token

Example account Token: MPh0vm2rva53Bv1pbdzz1Q

String vendorKey: an encrypted form of the partner’s vendor key which is used to double check

String code: the registration code (package code), eg “AB12MH” or “MHP1234gtvde89”, that you would like to query on

String nonce: unique value that is passed along to every API call that prevents replay attacks.

Returns:

The tracker’s name, the tracker’s due date, and a list of items that the data owner has required for that tracker. If the user has not selected a tracker yet, then this call will return a trackerNamed “None Selected” and all other fields will be blank.

An Array of Items:

String itemStatus: an enumeration of five possible values (approved, rejected, expired, pending, incomplete).

String itemName: the name of the item
Long nextActionDate: date representing the next action that’s required by the system. A zero if there is no nextAction date (eg the item is complete). (in CDT)

Long administeredDate: date representing the administered date that was captured from the reviewer in the system

Long lastModifiedDate: date representing the last time the answer was edited. Usually this is the student fulfilling the requirement or the reviewer reviewing it.

String recordType: string representing the record type as specified by the reviewer.

String trackerName: the name of the tracker that this user belongs to, or an empty string if they have not selected a tracker yet.

Long dueDate: a long representing a date that this tracker is due

Boolean complete: if the student is complete and fully reviewed

Integer numComplete: number of requirements the student has completed

Integer numItems: total number of requirements for the student to fill out

Example
JSON Sent:

{“accountToken”:”MPh0vm2rva53Bv1pbdzz1Q”, “vendorKey”:”Azy834Itlw0”, “code”:”AB12MH”, “nonce”:”267446780000”}

Returns:

{“trackerName”:”Magnus University”,”dueDate”:259445405250, “numComplete”: 1, “numItems”: 2, “complete”, false, “Items”:[{“itemName”:”2011 Physical”,”itemStatus”:”pending”,”nextActionDate”: 259446655250, “administeredDate”: 259406655250, “lastModifiedDate”: 259426655250, “recordType”: “”},{“itemName”:”Hep B”,”itemStatus”:”expired”,”nextActionDate”: 259446655250, “administeredDate”: 259406655250, “lastModifiedDate”: 259426655250, “recordType”: “”} } }