Enroll User API

Overview

This API will enroll the user into the REL-ID System along with their personal information. The SDK triggers an onUserEnrollmentResponse callback event upon successful response.



📥 Request Parameters

ParameterTypeRequiredDescription
userIDString✅ YesUnique identifier for the user. This ID will be used during activation and login.
firstNameString✅ YesUser's first name.
lastNameString✅ YesUser's last name.
emailIDString✅ YesUser’s email address.
mobileNumberString✅ YesUser’s mobile number.
groupNameString❌ No(Optional) Currently not in use. Can be passed as an empty string.

Code Examples

React Native
RdnaClient.enrollUser(
  userID,
  firstName,
  lastName,
  emailId,
  mobileNumber,
  groupName,
  (syncResponse) => {
    // Handle the response here
  }
);

Flutter
rdnaClient.enrollUser(
  <userID as String>,
  <FirstName as String>,
  <LastName as String>,
  <Email as String>,
  <MobileNumber as String>,
  <groupName as String> // Optional — can be an empty string
);

Cordova
com.uniken.rdnaplugin.RdnaClient.enrollUser(
  successCallback,
  errorCallback,
  [
    "<userID>",
    "<FirstName>",
    "<LastName>",
    "<Email>",
    "<MobileNumber>",
    "<groupName>" // Optional — pass empty string if not used
  ]
);

iOS (Objective-C)
(RDNAError *)enrollUser:(NSString *)userID
              firstName:(NSString *)firstName
               lastName:(NSString *)lastName
                  email:(NSString *)email
           mobileNumber:(NSString *)mobileNumber
             groupName:(NSString *)groupName;

Android (Java)
RDNA.RDNAError enrollUser(
  String userID,
  String firstName,
  String lastName,
  String email,
  String mobileNumber,
  String groupName // Optional — pass empty string if not used
);

📤 Response: enrollUser

The enrollUser method returns an RDNAError JSON object that indicates whether the operation was successful or if an error occurred.

🔑 Response Fields

FieldTypeDescription
longErrorCodeStringA nine-digit error code for debugging. Share this with REL-ID support for issue resolution.
shortErrorCodeStringA short numeric code representing specific error types. Useful for conditional error handling.
errorStringStringA human-readable error message for UI display or logs.

✅ Success Response

{
  "longErrorCode": "000000000",
  "shortErrorCode": "0",
  "errorString": ""
}

💡 Note: On success, both longErrorCode and shortErrorCode will be "0", and errorString will be empty.


❌ Error Response

{
  "longErrorCode": "987654321",
  "shortErrorCode": "102",
  "errorString": "User already enrolled"
}

> > Possible error scenarios for enrollUser API <TBD>




🔁 Event: onUserEnrollmentResponse callback method invoked by SDK

The onUserEnrollmentResponse event is a key mechanism used by the REL-ID SDK to communicate the result of the enrollUser API call, back to the application.


📌 Purpose

This event acts as the callback response to the enrollUser API. It allows the application to:

  • Confirm whether the user was successfully enrolled.
  • Handle errors or show appropriate messages if the enrollment failed.
  • Access relevant status and error details from the enrollment process.

📤 Sample Event Payload

{
  "enrolledUserID": "ad3",
  "status": {
    "statusCode": 100,
    "statusMessage": ""
  },
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  }
}

🔑 Event Fields

FieldTypeDescription
enrolledUserIDStringThe unique user ID that was successfully enrolled.
status.statusCodeIntegerRepresents the result of the enrollment (100 typically indicates success).
status.statusMessageStringAdditional message for the status (usually empty on success).
error.longErrorCodeIntegerA long, 9-digit error code for debugging. 0 means no error.
error.shortErrorCodeIntegerShort integer code for handling specific error cases.
error.errorStringStringUser-friendly message describing the result ("Success" on successful enrollment).

💡 Note: The application should listen for this event and use the response data to guide the next steps in the workflow (e.g., show success message, retry on failure, etc.).


Listening to the event

prerequisite : REL-ID SDK should be initialized


React Native
let onUserEnrollmentResponseSubscription = rdnaEventRegistery.addListener(
  'onUserEnrollmentResponse',
  this.onUserEnrollmentResponse.bind(this)
);
Flutter
rdnaClient.on(RdnaClient.onUserEnrollmentResponse, onUserEnrollmentResponse);

void onUserEnrollmentResponse(RDNAUserEnrollmentResponse response) {
  // Handle the enrollment result here
}
Cordova
document.addEventListener(
  'onUserEnrollmentResponse',
  this.onUserEnrollmentResponse.bind(this),
  false
);
iOS (Objective-C)
(void)onUserEnrollmentResponse:(NSString*)enrolledUserID
                        status:(RDNARequestStatus *)status
                         error:(RDNAError *)error {
  // Handle enrollment callback
}
Android (Java)
void onUserEnrollmentResponse(
  String enrolledUserID,
  RDNA.RDNARequestStatus requestStatus,
  RDNA.RDNAError error
) {
  // Handle enrollment response
}