This section details about the service API in the Pre-Registration modules.
Note: The id, version and requesttime in request and responsetime in response bodies are optional fields and not consumed by pre-registration application unless defined. Though we need to pass these as part of the request, it should not be tested. Few of the error messages are intended for API consumer, who are mostly SI and developers. User friendly messages need to be mapped in the UI reference implementation.
API testing Prerequisites
Generate a Authorization Token by using following Kernel AuthManager APIs
Use this Authorization token in the every request header of all pre-registration APIs.
Login Service (Public)
This service details used by Pre-Registration portal to authenticate user by sending OTP to the user, validating with userid and OTP.
POST /login/sendOtp
This request will send the OTP to the requested user in the preferred channel(sms/email)
Resource URL
https://{base_url}/preregistration/v1/login/sendOtp
Resource details
Request Part Parameters
For SMS
Request for SMS
Copy {
"id": "mosip.pre-registration.login.sendotp",
"version": "1.0",
"requesttime": "2019-05-14T07:24:47.605Z",
"request": {
"userId": "8907654778"
}
}
Responses for SMS
Success Response
Status code : 200
Description : OTP sent successfully to specified channel
Copy {
"id": "mosip.pre-registration.login.sendotp",
"version": "1.0",
"responsetime": "2019-06-03T06:41:46.796Z",
"response": {
"message": "Sms Request Sent",
"status": "success"
},
"errors": null
}
For Email
Request for Email
Copy {
"id": "mosip.pre-registration.login.sendotp",
"version": "1.0",
"requesttime": "2019-05-14T07:24:47.605Z",
"request": {
"userId": "info@mosip.io"
}
}
Responses for Email
Success Response
Status code : 200
Description : OTP sent successfully to specified channel
Copy {
"id": "mosip.pre-registration.login.sendotp",
"version": "1.0",
"responsetime": "2019-06-03T06:41:46.796Z",
"response": {
"message": "Email Request submitted",
"status": "success"
},
"errors": null
}
Failure Response
Status code : 200
Description : Invalid parameters
Copy {
"id": "mosip.pre-registration.login.sendotp",
"version": "1.0",
"responsetime": "2019-05-14T16:46:39.582Z",
"response": null,
"errors": [
{
"errorCode": "PRG_AUTH_001",
"message": "OTP failed to send through a specified channel"
}
]
}
Other Failure details
POST /login/validateOtp
This request will validate the OTP with respect to userid and provide the authorize token in the browser cookies.
Resource URL
https://{base_url}/preregistration/v1/login/validateOtp
Resource details
Request Part Parameters
Request
Copy {
"id": "mosip.pre-registration.login.useridotp",
"version": "1.0",
"requesttime": "2019-06-03T08:28:04.783Z",
"request": {
"otp": "345674",
"userId": "8907654778"
}
}
Responses
Success Response
Status code : 200
Description : sms sent successfully
Copy {
"id": "mosip.pre-registration.login.useridotp",
"version": "1.0",
"responsetime": "2019-06-03T06:47:10.838Z",
"response": {
"message": "VALIDATION_SUCCESSFUL",
"status": "success"
},
"errors": null
}
Failure Response
Status code : 200
Description : Invalid parameters
Copy {
"id": "mosip.pre-registration.login.useridotp",
"version": "1.0",
"responsetime": "2019-06-03T18:03:12.305Z",
"response": null,
"errors": [
{
"errorCode": "KER-OTV-005",
"message": "Validation can't be performed against this key. Generate OTP first."
}
]
}
Other Failure details
POST /login/invalidateToken
This request will invalidate the authorization token when force logout is done.
Resource URL
https://{base_url}/preregistration/v1/login/invalidateToken
Resource details
Responses
Success Response
Status code : 200
Description : Token invalidated successfully
Copy {
"id": "mosip.pre-registration.login.invalidate",
"version": "1.0",
"responsetime": "2019-05-16T09:37:04.941Z",
"response": {
"message": "Token has been invalidated successfully",
"status": "success"
},
"errors": null
}
Failure Response
Status code : 200
Description : Token is not present in cookies
Copy {
"id": "mosip.pre-registration.login.invalidate",
"version": "1.0",
"responsetime": "2019-06-14T08:41:17.156Z",
"response": null,
"errors": [
{
"errorCode": "KER-ATH-007",
"message": "Token is not present in cookies"
}
]
}
Other Failure details
GET /login/config
This request will load the configuration parameters while loading the pre-registration portal page.
All the values are retrieving from the pre-registration config properties file. If any value get changed in the config properties file it will get reflected in the response of this API. Following mentioned response is the sample of that.
Resource URL
https://{base_url}/preregistration/v1/login/config
Resource details
Responses
Success Response
Status code : 200
Description : Config parameter retrieved sucessfully
Copy {
"id": "mosip.pre-registration.login.config",
"version": "1.0",
"responsetime": "2019-05-14T16:01:20.534Z",
"response": {
"mosip.kernel.otp.default-length": "6",
"mosip.id.validation.identity.postalCode": "^[(?i)A-Z0-9]{5}$",
"mosip.left_to_right_orientation": "eng,fra",
"preregistration.recommended.centers.locCode": "5",
"mosip.kernel.otp.validation-attempt-threshold": "10",
"mosip.country.code": "MOR",
"mosip.primary-language": "fra",
"preregistration.timespan.cancel": "1",
"mosip.default.dob.month": "01",
"mosip.preregistration.auto.logout.timeout": "60",
"preregistration.availability.noOfDays": "5",
"mosip.kernel.otp.expiry-time": "180",
"mosip.id.validation.identity.dateOfBirth": "^\\d{4}/([0]\\d|1[0-2])/([0-2]\\d|3[01])$",
"mosip.supported-languages": "eng,ara,fra",
"preregistration.workflow.documentupload": "true/false",
"preregistration.workflow.demographic": "true/false",
"preregistration.documentupload.allowed.file.nameLength": "50",
"mosip.id.validation.identity.postalCode.length": "5",
"mosip.kernel.sms.number.length": "10",
"preregistration.availability.sync": "6",
"mosip.id.validation.identity.email.length": "50",
"preregistration.timespan.rebook": "1",
"mosip.id.validation.identity.email": "^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-z]{2,})$",
"mosip.id.validation.identity.age": "^(150|1[0-4][0-9]|[1-9]?[0-9])$",
"mosip.id.validation.identity.referenceIdentityNumber": "^([0-9]{10,30})$",
"mosip.right_to_left_orientation": "ara",
"mosip.kernel.pin.length": "6",
"mosip.id.validation.identity.phone": "^([6-9]{1})([0-9]{9})$",
"preregistration.workflow.booking": "true/false",
"mosip.preregistration.auto.logout.ping": "30 ",
"mosip.id.validation.identity.referenceIdentityNumber.length": "30",
"mosip.id.validation.identity.fullName.[*].value": "^(?=.{0,50}$).*",
"mosip.id.validation.identity.addressLine1.[*].value": "^(?=.{0,50}$).*",
"mosip.login.mode": "email,mobile",
"mosip.id.validation.identity.phone.length": "10",
"mosip.preregistration.auto.logout.idle": "180",
"preregistration.auto.logout": "10",
"mosip.secondary-language": "ara",
"preregistration.nearby.centers": "2000",
"preregistration.documentupload.allowed.file.size": "1000000",
"mosip.default.dob.day": "01",
"preregistration.booking.offset": "1",
"preregistration.documentupload.allowed.file.type": "application/pdf,image/jpeg,image/png,image/gif"
},
"errors": null
}
Other Failure details
GET /login/refreshconfig
This request will reload the configuration parameters.
When ever there is change in the property file, then this rest end point should be called manually,so that the property get reflected.
Resource URL
https://{base_url}/preregistration/v1/login/refreshconfig
Resource details
Responses
Success Response
Status code : 200
Description : Config parameter retrieved sucessfully
Copy {
"id": "mosip.pre-registration.login.config",
"version": "1.0",
"responsetime": "2019-08-08T07:43:45.908Z",
"response": "success",
"errors": null
}
Other Failure details
Demographic Service (public)
This service details used by Pre-Registration portal to maintain the demographic data by providing his/her basic details.
POST /applications
This request is used to create new pre-registration with demographic details, which generates pre-registration id and associates it with demographic details.
Resource URL
https://{base_url}/preregistration/v1/applications
Resource details
Request Body Parameters
Request
Copy {
"id": "mosip.pre-registration.demographic.create",
"version": "1.0",
"request": {
"langCode": "eng",
"demographicDetails": {
"identity": {
"IDSchemaVersion": 1,
"fullName": [
{
"language": "eng",
"value": "Puja Thakur"
},
{
"language": "ara",
"value": "پُجَ تهَكُر"
}
],
"dateOfBirth": "1996/01/01",
"gender": [
{
"language": "eng",
"value": "MLE"
},
{
"language": "ara",
"value": "MLE"
}
],
"addressLine1": [
{
"language": "eng",
"value": "Green olive villa"
},
{
"language": "ara",
"value": "گرِِن ُلِڤِ ڤِللَ"
}
],
"residenceStatus": [
{
"language": "eng",
"value": "FR"
},
{
"language": "ara",
"value": "FR"
}
],
"addressLine2": [
{
"language": "eng",
"value": "22 ananda reddy Layout"
},
{
"language": "ara",
"value": "٢٢ َنَندَ رِددي لَيُُت"
}
],
"addressLine3": [
{
"language": "eng",
"value": ""
},
{
"language": "ara",
"value": ""
}
],
"region": [
{
"language": "eng",
"value": "RSK"
},
{
"language": "ara",
"value": "RSK"
}
],
"province": [
{
"language": "eng",
"value": "KTA"
},
{
"language": "ara",
"value": "KTA"
}
],
"city": [
{
"language": "eng",
"value": "KNT"
},
{
"language": "ara",
"value": "KNT"
}
],
"zone": [
{
"language": "eng",
"value": "BNMR"
},
{
"language": "ara",
"value": "BNMR"
}
],
"postalCode": "14022",
"phone":"9999999999",
"email": "mosip@gmail.com",
"referenceIdentityNumber": "12312312312312"
}
}
},
"requesttime": "2019-08-19T11:18:48.393Z"
}
Responses
Success Response
Status code : 200
Description : Pre-Registration successfully Created
Copy {
"id": "mosip.pre-registration.demographic.create",
"version": "1.0",
"responsetime": "2019-08-19T11:18:51.326Z",
"response": {
"preRegistrationId": "46537143845798",
"createdDateTime": "2019-08-19T11:18:51.281Z",
"statusCode": "Pending_Appointment",
"langCode": "eng",
"demographicDetails": {
"identity": {
"gender": [
{
"language": "eng",
"value": "MLE"
},
{
"language": "ara",
"value": "MLE"
}
],
"city": [
{
"language": "eng",
"value": "KNT"
},
{
"language": "ara",
"value": "KNT"
}
],
"postalCode": "14022",
"fullName": [
{
"language": "eng",
"value": "Puja Thakur"
},
{
"language": "ara",
"value": "پُجَ تهَكُر"
}
],
"dateOfBirth": "1996/01/01",
"referenceIdentityNumber": "12312312312312",
"phone":"9999999999",
"email": "mosip@mosip.io",
"IDSchemaVersion": 1,
"province": [
{
"language": "eng",
"value": "KTA"
},
{
"language": "ara",
"value": "KTA"
}
],
"zone": [
{
"language": "eng",
"value": "BNMR"
},
{
"language": "ara",
"value": "BNMR"
}
],
"addressLine1": [
{
"language": "eng",
"value": "Green olive villa"
},
{
"language": "ara",
"value": "گرِِن ُلِڤِ ڤِللَ"
}
],
"residenceStatus": [
{
"language": "eng",
"value": "FR"
},
{
"language": "ara",
"value": "FR"
}
],
"addressLine2": [
{
"language": "eng",
"value": "22 ananda reddy Layout"
},
{
"language": "ara",
"value": "٢٢ َنَندَ رِددي لَيُُت"
}
],
"addressLine3": [
{
"language": "eng",
"value": ""
},
{
"language": "ara",
"value": ""
}
],
"region": [
{
"language": "eng",
"value": "RSK"
},
{
"language": "ara",
"value": "RSK"
}
]
}
}
},
"errors": null
}
Failure Response
Status code : 200
Description : invalid or empty request id
Copy {
"id": "mosip-registration.demographic.create",
"version": "1.0",
"responsetime": "2019-05-20T05:52:20.435Z",
"response": null,
"errors": [
{
"errorCode": "PRG_PAM_CORE_001",
"message": "Request id is invalid"
}
]
}
Other Failure details
PUT /applications/{preRegistrationId}
This request is used to update pre-registration's demographic details by providing pre-registration id in the path parameter and updated demographic details in request body.
Resource URL
https://{base_url}/preregistration/v1/applications/{preRegistrationId}
Resource details
Request Path Parameters
Request Body Parameters
Request
Copy {
"id": "mosip.pre-registration.demographic.update",
"version": "1.0",
"request": {
"langCode": "eng",
"demographicDetails": {
"identity": {
"IDSchemaVersion": 1,
"fullName": [
{
"language": "eng",
"value": "Puja Thakur"
},
{
"language": "ara",
"value": "پُجَ تهَكُر"
}
],
"dateOfBirth": "1996/01/01",
"gender": [
{
"language": "eng",
"value": "MLE"
},
{
"language": "ara",
"value": "MLE"
}
],
"addressLine1": [
{
"language": "eng",
"value": "Green olive villa"
},
{
"language": "ara",
"value": "گرِِن ُلِڤِ ڤِللَ"
}
],
"residenceStatus": [
{
"language": "eng",
"value": "FR"
},
{
"language": "ara",
"value": "FR"
}
],
"addressLine2": [
{
"language": "eng",
"value": "22 ananda reddy Layout"
},
{
"language": "ara",
"value": "٢٢ َنَندَ رِددي لَيُُت"
}
],
"addressLine3": [
{
"language": "eng",
"value": ""
},
{
"language": "ara",
"value": ""
}
],
"region": [
{
"language": "eng",
"value": "RSK"
},
{
"language": "ara",
"value": "RSK"
}
],
"province": [
{
"language": "eng",
"value": "KTA"
},
{
"language": "ara",
"value": "KTA"
}
],
"city": [
{
"language": "eng",
"value": "KNT"
},
{
"language": "ara",
"value": "KNT"
}
],
"zone": [
{
"language": "eng",
"value": "BNMR"
},
{
"language": "ara",
"value": "BNMR"
}
],
"postalCode": "14022",
"phone":"9999999999",
"email": "mosip@mosip.io",
"referenceIdentityNumber": "12312312312312"
}
}
},
"requesttime": "2019-08-19T11:18:48.393Z"
}
Responses
Success Response
Status code : 200
Description : Pre-Registration demographic details successfully updated
Copy {
"id": "mosip.pre-registration.demographic.update",
"version": "1.0",
"responsetime": "2019-08-19T11:18:51.326Z",
"response": {
"preRegistrationId": "46537143845798",
"createdDateTime": "2019-08-19T11:18:51.281Z",
"statusCode": "Pending_Appointment",
"langCode": "eng",
"demographicDetails": {
"identity": {
"gender": [
{
"language": "eng",
"value": "MLE"
},
{
"language": "ara",
"value": "MLE"
}
],
"city": [
{
"language": "eng",
"value": "KNT"
},
{
"language": "ara",
"value": "KNT"
}
],
"postalCode": "14022",
"fullName": [
{
"language": "eng",
"value": "Puja Thakur"
},
{
"language": "ara",
"value": "پُجَ تهَكُر"
}
],
"dateOfBirth": "1996/01/01",
"referenceIdentityNumber": "12312312312312",
"IDSchemaVersion": 1,
"province": [
{
"language": "eng",
"value": "KTA"
},
{
"language": "ara",
"value": "KTA"
}
],
"zone": [
{
"language": "eng",
"value": "BNMR"
},
{
"language": "ara",
"value": "BNMR"
}
],
"addressLine1": [
{
"language": "eng",
"value": "Green olive villa"
},
{
"language": "ara",
"value": "گرِِن ُلِڤِ ڤِللَ"
}
],
"residenceStatus": [
{
"language": "eng",
"value": "FR"
},
{
"language": "ara",
"value": "FR"
}
],
"addressLine2": [
{
"language": "eng",
"value": "22 ananda reddy Layout"
},
{
"language": "ara",
"value": "٢٢ َنَندَ رِددي لَيُُت"
}
],
"addressLine3": [
{
"language": "eng",
"value": ""
},
{
"language": "ara",
"value": ""
}
],
"region": [
{
"language": "eng",
"value": "RSK"
},
{
"language": "ara",
"value": "RSK"
}
],
"phone": "9999999999",
"email": "mosip@mosip.io"
}
}
},
"errors": null
}
Failure Response
Status code : 200
Description : Invalid preregistration id(non-empty) or data is not found for that preregistration id.
Copy {
"id": "mosip.pre-registration.demographic.update",
"version": "1.0",
"responsetime": "2019-05-20T06:31:35.160Z",
"response": null,
"errors": [
{
"errorCode": "PRG_PAM_APP_005",
"message": "No data found for the requested pre-registration id"
}
]
}
Other Failure details
GET /applications/{preRegistrationId}
This request is used to retrieve Pre-Registration demographic data by pre-Registration id provided in request path parameter.
Resource URL
https://{base_url}/preregistration/v1/applications/{preRegistrationId}
Resource details
Request Path Parameters
Responses
Success Response:
Status code : 200
Description : Demographic data successfully retrieved
Copy {
"id": "mosip.pre-registration.demographic.retrieve.details",
"version": "1.0",
"responsetime": "2019-05-20T06:33:08.516Z",
"response": {
"preRegistrationId": "32042841521591",
"createdBy": "8754462073",
"createdDateTime": "2019-05-20T06:25:00.262Z",
"updatedBy": "8754462073",
"updatedDateTime": "2019-05-20T06:30:37.900Z",
"statusCode": "Pending_Appointment",
"langCode": "fra",
"demographicDetails": {
"identity": {
"referenceIdentityNumber": "9182345678456",
"gender": [
{
"language": "fra",
"value": "MLE"
},
{
"language": "ara",
"value": "MLE"
}
],
"city": [
{
"language": "fra",
"value": "BNMR"
},
{
"language": "ara",
"value": "BNMR"
}
],
"postalCode": "56059",
"fullName": [
{
"language": "fra",
"value": "Rakesh P"
},
{
"language": "ara",
"value": "سهَسهَنك "
}
],
"zone": [
{
"language": "fra",
"value": "14022"
},
{
"language": "ara",
"value": "14022"
}
],
"dateOfBirth": "1993/12/12",
"IDSchemaVersion": 1,
"province": [
{
"language": "fra",
"value": "KTA"
},
{
"language": "ara",
"value": "KTA"
}
],
"phone": "9680958812",
"addressLine1": [
{
"language": "fra",
"value": "005-DS Max Silicon"
},
{
"language": "ara",
"value": "٠٠٥-دس مَكس سِلِكُن"
}
],
"residenceStatus": [
{
"language": "fra",
"value": "NFR"
},
{
"language": "ara",
"value": "NFR"
}
],
"addressLine2": [
{
"language": "fra",
"value": "Global Village"
},
{
"language": "ara",
"value": "گلُبَل ڤِللَگِ"
}
],
"addressLine3": [
{
"language": "fra",
"value": "Karnataka"
},
{
"language": "ara",
"value": "كَرنَتَكَ"
}
],
"region": [
{
"language": "fra",
"value": "RSK"
},
{
"language": "ara",
"value": "RSK"
}
],
"email": "rak@gmail.com"
}
}
},
"errors": null
}
Failure Response
Status code : '200'
Description : No data found for the requested pre-registration id(non-empty).
Copy {
"id": "mosip.pre-registration.demographic.retrieve.details",
"version": "1.0",
"responsetime": "2019-05-20T06:35:18.678Z",
"response": null,
"errors": [
{
"errorCode": "PRG_PAM_APP_005",
"message": "No data found for the requested pre-registration id"
}
]
}
Other Failure details
GET /applications/status/{preRegistrationId}
This request is used to retrieve pre-registration application status by providing the pre-registration id in request path parameter.
Resource URL
https://{base_url}/preregistration/v1/applications/status/{preRegistrationId}
Resource details
Request Path Parameter
Responses
Success Response
Status code : 200
Description : All applications status fetched successfully
Copy {
"id": "mosip.pre-registration.demographic.retrieve.status",
"version": "1.0",
"responsetime": "2019-05-14T16:17:19.601Z",
"response": {
"preRegistartionId": "29810389154051",
"statusCode": "Pending_Appointment"
},
"errors": null
}
Failure Response
Status code : 200
Description : No data found for the requested pre-registration id(non-empty).
Copy {
"id": "mosip.pre-registration.demographic.retrieve.status",
"version": "1.0",
"responsetime": "2019-05-14T16:17:34.330Z",
"response": null,
"errors": [
{
"errorCode": "PRG_PAM_APP_005",
"message": "No data found for the requested pre-registration id"
}
]
}
Other Failure details
GET /applications
This request is used to retrieve all Pre-Registration id, Full name in both language, Status Code, Document details(Only for Proof Of Address), Appointment details and Postal Code by user id from authorization token.
if pageIndex parameter is not passed as query param, then all the demographic data for the user will be retrieved without applying pagination mechanism.
Resource URL
https://{base_url}/preregistration/v1/applications
Resource details
Responses
Success Response
Status code : 200
Description : All applications fetched successfully
Copy {
"id": "mosip.pre-registration.demographic.retrieve.basic",
"version": "1.0",
"responsetime": "2019-06-27T10:44:18.988Z",
"response": {
"basicDetails": [
{
"preRegistrationId": "26501647251326",
"statusCode": "Pending_Appointment",
"bookingMetadata": null,
"demographicMetadata": {
"proofOfAddress": null,
"postalCode": "14022",
"fullName": [
{
"language": "fra",
"value": "jagadishwari"
},
{
"language": "ara",
"value": "جَگَدِسهوَرِ سِلڤَرَج"
}
]
}
},
{
"preRegistrationId": "31601973604129",
"statusCode": "Booked",
"bookingMetadata": {
"registration_center_id": "10003",
"appointment_date": "2019-07-01",
"time_slot_from": "14:15",
"time_slot_to": "14:30"
},
"demographicMetadata": {
"proofOfAddress": {
"docCatCode": "POA",
"docTypCode": "RNC",
"docName": "Rajath.pdf",
"langCode": "eng",
"documentId": "ef51cd37-98c7-11e9-8fd2-6fbffb0a0035"
},
"postalCode": "14023",
"fullName": [
{
"language": "eng",
"value": "Rajath"
},
{
"language": "ara",
"value": "رَجَته"
}
]
}
}
],
"totalRecords": "2",
"noOfRecords": "0",
"pageIndex": "0"
},
"errors": null
}
Failure Response
Status code : 200
Description : No record found for the requested user id.
Copy {
"id": "mosip.pre-registration.demographic.retrieve.basic",
"version": "1.0",
"responsetime": "2019-05-20T07:12:37.316Z",
"response": null,