User Registration Server API

2021-06-12

This topic is under construction.

User/Registration Services

User/Registration Services provide mechanisms to register users, manage their profiles, settings, preferences, activity and progress in the app.

Learn about Phase 2A Changes to this API in this topic: Mobile Client API.

Headers for User/Registration Services

Request header for all user/registration requests (auth and userId is not required for login/registration/forgot password)

HeaderParamsValues
authstring; authentication token
userIdstring
orgIdstring
applicationIdstring

Response header for all user/registration requests

HeaderParamsValues
statushttp status code
StatusMessagestring

RegisterUser

Register new user.

Request:

MethodURL
POST/register

ParamsValues
emaiIdstring
passwordstring

Response:

ParamsValues
messagestring
userIdstring
verifiedbool
authstring
refreshTokenstring

ConfirmRegistration

Confirm user registration.

Request:

MethodURL
POST/verify

ParamsValues
emailIdstring
codestring

Response:

ParamsValues
messagestring

ResendConfirmation

Resend confirmation email.

Request:

MethodURL
POST/resendConfirmation

ParamsValues
emailIdstring

Response:

ParamsValues
messagestring

LoginUser

Login user.

Request:

MethodURL
POST/login

ParamsValues
emailIdstring
passwordstring

Response:

ParamsValues
messagestring
userIdstring
verifiedbool
authstring
refreshTokenstring
resetPasswordbool; true if login with temporary password

LogoutUser

Logout user.

Request:

MethodURL
DELETE/logout

ParamsValues
reasonstring; user_action/error/security(jailbroken/rooted)

Response:

ParamsValues
messagestring

ForgotPassword

Request to reset password.

Request:

MethodURL
POST/forgotPassword

ParamsValues
emailIdstring

Response:

ParamsValues
messagestring

ChangePassword

Request to change password.

Request:

MethodURL
POST/changePassword

ParamsValues
currentPasswordstring
newPasswordstring

Response:

ParamsValues
messagestring

GetUserProfile

Fetch saved user profile from the server.

Request:

MethodURL
GET/userProfile

Response:

ParamsValues
messagestring
profile
{
"emailId": string
}
settings
{
"remoteNotifications": bool,
"localNotifications" :bool,
"touchId" :bool,
"passcode" :bool,
"locale" :string,
"reminderLeadTime": string
}

UpdateUserProfile

Update user profile on server.

Request:

MethodURL
POST/updateUserProfile

ParamsValues
settings
{
"remoteNotifications": bool,
"localNotifications": bool,
"touchId": bool,
"passcode": bool,
"reminderLeadTime" :string,
"locale": string
}
info
{
"os": string, android/ios
"appVersion": string,
"deviceToken": string
}
participantInfo
{
"studyId": string,
"participantId": string,
"enrolledDate": string
}

Response:

ParamsValues
messagestring

GetStudyState

Fetch studies state

Request:

MethodURL
GET/studyState

Response:

ParamsValues
messagestring
studies
[
{
"studyId": string,
"status": string,
"enrolledDate": string,
"participantId": string,
"bookmarked": bool,
"completion": integer,
"adherence": integer,
}
]

UpdateStudyState

Update study state

Request:

MethodURL
POST/updateStudyState

ParamsValues
studies
[
{
"studyId": string,
"status": string,
"enrolledDate": string,
"participantId": string,
"bookmarked": bool,
"completion": integer,
"adherence": integer
}
]

Response:

ParamsValues
messagestring

UpdateEligibilityConsentStatus

Update eligibility and consent status.

Request:

MethodURL
POST/updateEligibilityConsentStatus

ParamsValues
studyIdstring;
eligbibilitybool; eligible/not eligible
consent
{
"version": string, consent version
"status": string, completed/pending
"pdf": string base-64 encoded string
}
sharingstring;

Response:

ParamsValues
messagestring

GetConsentDocument

Download consent PDF from server by passing studyId and consent version. If no consent version is provided, latest version of consent should be returned.

LabKey will also use this service, in that case, user id in header params should be treated as app token/participant id.

Request:

MethodURL
GET/consentDocument

ParamsValues
studyIdstring
consentVersionstring

Response:

ParamsValues
messagestring
consent
{
"version":string, consent version
"type": string, application/pdf
"content": string base-64 encoded string
}
sharingstring;

UpdateActivityState

Update activity state.

Request:

MethodURL
POST/updateActivityState

ParamsValues
studyIdstring; study identifier
activity
[
{
"activityId": string, activity identifier
"activityVersion": string, activity version
"activityRunId": string, activity run identifier
"activityState": string, activity state
"bookmarked": bool,
"activityStartDate": string,
"activityEndDate": string,
"anchorDateVersion": string,
"anchorDatecreatedDate": "string",
"lastModifiedDate": string,
"customScheduleRuns": [{
"runStartDate": string,
"runEndDate": string
}],
"activityRun": {
"total" :integer,
"completed" :integer,
"missed" :integer
}
}
]

Response:

ParamsValues
messagestring

GetActivityState

Fetch activity state.

Request:

MethodURL
GET/activityState

ParamsValues
studyIdstring; study identifier

Response:

ParamsValues
messagestring
activities
[
{
"activityId": string,
"activityVersion": string,
"activityRunId": string,
"activityState": string, activity state
"bookmarked": bool,
"activityStartDate": string,
"activityEndDate": string,
"anchorDateVersion": string,
"lastModifiedDate": string,
"anchorDatecreatedDate": string,
"customScheduleRuns": [{
"runStartDate": string,
"runEndDate": string
}],
"activityRun": {
"total":integer,
"completed":integer,
"missed":integer
}
}
]

WithdrawFromStudy

Delete user’s study info from server.

Request:

MethodURL
DELETE/withdraw

ParamsValues
studyIdstring; study id
deleteDatabool: should delete study data

Response:

ParamsValues
messagestring

Deactivate Account

Request:

MethodURL
DELETE/deactivate

ParamsValues
deleteDatastring array(array of studyIds)

Response:

ParamsValues
messagestring

Feedback

Provide feedback about the app.

Request:

MethodURL
POST/feedback

ParamsValues
subjectstring
bodystring

Response:

ParamsValues
messagestring

ContactUs

Reach out to app owner

Request:

MethodURL
POST/contactUs

ParamsValues
subjectstring
bodystring
firstNamestring
emailstring

Response:

ParamsValues
messagestring

Refresh Token

Get new accesstoken and refreshtoken.

Request:

MethodURL
POST/refreshToken

ParamsValues
refreshTokenstring

Response:

ParamsValues
messagestring
userIdstring
authstring
refreshTokenstring

Send Notification

For sending notifications.

Request:

MethodURL
POST/sendNotification

ParamsValues
notifications
[
{
"customStudyId": string,
"notificationText": string,
"notificationTitle": string,
"notificationType": string,
"notificationSubType": string
}
]

Response:

ParamsValues
messagestring

App Properties

For setting the properties of the app.

Request:

MethodURL
POST/appPropertiesUpdate

ParamsValues
appIdstring
orgIdstring
androidBundleIdstring
androidServerKeystring
iosBundleIdstring
iosCertificatestring
iosCertificatePasswordstring
emailstring
emailPasswordstring
registerEmailSubjectstring
registerEmailBodystring <refer to Appendix - Email Body>
forgotPassEmailSubjectstring
forgotPassEmailBodystring <refer to Appendix - Email Body>
feedbackEmailstring
contactUsEmailstring
appNamestring
methodHandlerstring

Response:

ParamsValues
messagestring

Appendix - Email Body

The body of the emails need to be in HTML format and the <<< TOKEN HERE >>> part represents an identifier for the verification code or temporary password dynamically generated for that email. All fields in the API are mandatory.

Register Email Body

Email subject for signup mail, replace ‘xxxxxx’ with your organization’s name that is offering the app, or other suitable text.

<html>
<body>
<div style='margin:20px; padding:10px; font-family: sans-serif;font-size: 14px;'>
<span>Hi, </span><br/><br/>
<span>Thank you for registering with us! We look forward to having you on board and actively taking part in<br/>research studies conducted by xxxxxx.
</span><br/><br/>
<span>Your sign-up process is almost complete. Please use the verification code provided below to<br/>complete the Verification step in the mobile app.
</span><br/><br/>
<span><strong>Verification Code:</strong> <<< TOKEN HERE >>>
</span><br/><br/>
<span>This code can be used only once and is valid for a period of 48 hours only.
</span><br/><br/>
<span>Please note that registration (or sign up) for the app is requested only to provide you with a <br/>seamless experience of using the app. Your registration information does not become part of <br/>the data collected for any study housed in the app. Each study has its own consent
process <br/> and no data for any study will be collected unless and until you provide an informed consent<br/> prior to joining the study </span><br/><br/>
<span>For any questions or assistance, please write to <a>Contact Email Address</a> </span><br/><br/>
<span style='font-size:15px;'>Thanks,</span><br/>
<span>The xxxxxx Team</span><br/>
<span>----------------------------------------------------</span><br/>
<span style='font-size:10px;'>PS - This is an auto-generated email. Please do not reply.</span>
</div>
</body>
</html>

Forgot Password Email Body

Email Body for Password Help email, replace ‘xxxxxx’ with your organization’s name that is offering the app, or other suitable text.

<html>
<body>
<div style='margin:20px;padding:10px;font-family: sans-serif;font-size: 14px;'>
<span>Hi,</span><br/><br/>
<span>Thank you for reaching out for password help.</span><br/><br/>
<span>Here is a temporary password which you can use to sign in to the (app name) App.<br/> You will be required to set up a new password after signing in.</span><br/><br/>
<span><strong>Temporary Password:</strong> <<< TOKEN HERE >>>
</span><br/><br/>

<span>Please note that this temporary password can be used only once and is valid for a period of 48 hours only.</span><br/><br/>
<span>For any questions or assistance, please write to <a> Contact Email Address </a> </span><br/><br/>
<span style='font-size:15px;'>Thanks,</span><br/><span>The xxxxxx Team</span><br/>
<span>----------------------------------------------------</span><br/>
<span style='font-size:10px;'>PS - This is an auto-generated email. Please do not reply. In case you did not request password help, please visit the app and change your password as a precautionary measure.
</span>
</div>
</body>
</html>

Related Topics