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
Parameter | Type | Required | Description |
---|---|---|---|
userID | String | ✅ Yes | Unique identifier for the user. This ID will be used during activation and login. |
firstName | String | ✅ Yes | User's first name. |
lastName | String | ✅ Yes | User's last name. |
emailID | String | ✅ Yes | User’s email address. |
mobileNumber | String | ✅ Yes | User’s mobile number. |
groupName | String | ❌ 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
enrollUser
The enrollUser
method returns an RDNAError
JSON object that indicates whether the operation was successful or if an error occurred.
🔑 Response Fields
Field | Type | Description |
---|---|---|
longErrorCode | String | A nine-digit error code for debugging. Share this with REL-ID support for issue resolution. |
shortErrorCode | String | A short numeric code representing specific error types. Useful for conditional error handling. |
errorString | String | A 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>
enrollUser
API <TBD>🔁 Event: onUserEnrollmentResponse
callback method invoked by SDK
onUserEnrollmentResponse
callback method invoked by SDKThe 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
Field | Type | Description |
---|---|---|
enrolledUserID | String | The unique user ID that was successfully enrolled. |
status.statusCode | Integer | Represents the result of the enrollment (100 typically indicates success). |
status.statusMessage | String | Additional message for the status (usually empty on success). |
error.longErrorCode | Integer | A long, 9-digit error code for debugging. 0 means no error. |
error.shortErrorCode | Integer | Short integer code for handling specific error cases. |
error.errorString | String | User-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
}
Updated 3 months ago