How to update demographic data using resident services API?

Using MOSIP’s resident services API we can easily update the demographic data. This can be achieved using the below steps.

Pre-requisites

  1. Prepare the identity JSON that you want to send to the registration processor. This should contain,

    1. All the demographic attributes to be updated

    2. Document attributes for the document to be attached.

    3. UIN number of the resident

    4. ID Schema version

  2. Sample Identity JSON

    { "identity": { "addressLine1": [ { "language": "fra", "value": "abc123" }, { "language": "ara", "value": "كُُرگ" } ], "city": [ { "language": "fra", "value": "RABAT HASSAN" }, { "language": "ara", "value": "الرباط حسان" } ], "province": [ { "language": "fra", "value": "Rabat" }, { "language": "ara", "value": "الرباط" } ], "zone": [ { "language": "fra", "value": "1ER ARRONDISSEMENT" }, { "language": "ara", "value": "المقاطعة الحضرية الاولى" } ], "region": [ { "language": "fra", "value": "Rabat-Salé-Kénitra" }, { "language": "ara", "value": "جهة الرباط سلا القنيطرة" } ], "proofOfAddress": { "format": "PDF", "type": "CCWE", "value": "proofOfAddress" }, "IDSchemaVersion": 0.2, "UIN": "8956913521" } }
  3. Now this Identity JSON should be base64encoded

  4. The byte array of the document should be base64URLencoded

  5. Now we can construct the body for the update request.

    { "id": "mosip.resident.updateuin", "version": "v1", "requesttime": "2020-04-07T08:58:04.683Z", "request": { "transactionID": "1234567890", "individualId": "8956913521", "individualIdType": "UIN", "otp": "111111", "identityJson": "ewoJImlkZW50aXR5IjogewoJCSJhZGRyZXNzTGluZTEiOiBbewoJCQkJImxhbmd1YWdlIjogImZyYSIsCgkJCQkidmFsdWUiOiAiYWJjMTIzIgoJCQl9LAoJCQl7CgkJCQkibGFuZ3VhZ2UiOiAiYXJhIiwKCQkJCSJ2YWx1ZSI6ICLZg9mP2Y/YsdqvIgoJCQl9CgkJXSwKCQkiY2l0eSI6IFt7CgkJCQkibGFuZ3VhZ2UiOiAiZnJhIiwKCQkJCSJ2YWx1ZSI6ICJSQUJBVCBIQVNTQU4iCgkJCX0sCgkJCXsKCQkJCSJsYW5ndWFnZSI6ICJhcmEiLAoJCQkJInZhbHVlIjogItin2YTYsdio2KfYtyDYrdiz2KfZhiIKCQkJfQoJCV0sCgkJInByb3ZpbmNlIjogW3sKCQkJCSJsYW5ndWFnZSI6ICJmcmEiLAoJCQkJInZhbHVlIjogIlJhYmF0IgoJCQl9LAoJCQl7CgkJCQkibGFuZ3VhZ2UiOiAiYXJhIiwKCQkJCSJ2YWx1ZSI6ICLYp9mE2LHYqNin2LciCgkJCX0KCQldLAoJCSJ6b25lIjogW3sKCQkJCSJsYW5ndWFnZSI6ICJmcmEiLAoJCQkJInZhbHVlIjogIjFFUiBBUlJPTkRJU1NFTUVOVCIKCQkJfSwKCQkJewoJCQkJImxhbmd1YWdlIjogImFyYSIsCgkJCQkidmFsdWUiOiAi2KfZhNmF2YLYp9i32LnYqSDYp9mE2K3Yttix2YrYqSDYp9mE2KfZiNmE2YkiCgkJCX0KCQldLAoJCSJyZWdpb24iOiBbewoJCQkJImxhbmd1YWdlIjogImZyYSIsCgkJCQkidmFsdWUiOiAiUmFiYXQtU2Fsw6ktS8Opbml0cmEiCgkJCX0sCgkJCXsKCQkJCSJsYW5ndWFnZSI6ICJhcmEiLAoJCQkJInZhbHVlIjogItis2YfYqSDYp9mE2LHYqNin2Lcg2LPZhNinINin2YTZgtmG2YrYt9ix2KkiCgkJCX0KCQldLAoJCSJwcm9vZk9mQWRkcmVzcyI6IHsKCQkJImZvcm1hdCI6ICJQREYiLAoJCQkidHlwZSI6ICJDQ1dFIiwKCQkJInZhbHVlIjogInByb29mT2ZBZGRyZXNzIgoJCX0sCgkJIklEU2NoZW1hVmVyc2lvbiI6IDAuMiwKCQkiVUlOIjogIjg5NTY5MTM1MjEiCgl9Cn0=", "documents": [ { "name": "proofOfAddress", "value": "<base64URLencoded byte array of the document>" } ] } }
  6. Please note that the “name” in the documents section and “value” in the proofOfAddress section should be the same.

Instructions

  1. Request for an OTP

    POST {{url}}/resident/v1/req/otp Request Body { "id": "mosip.identity.otp.internal", "individualId": "8956913521", "individualIdType": "UIN", "metadata": {}, "otpChannel": [ "EMAIL" ], "requestTime": "2020-04-07T08:58:04.683Z", "transactionID": "1234567890", "version": "1.0" }
  2. Send a demographic update request using the below API and the same transaction ID with the OTP.

  3. You can trace the RID for packet processing in the Registration Processor and use the same for status checks.

  4. Once the packet gets processed properly data will get updated in ID Repository and subsequently in IDA databases.

For this RID constructed here, it needs a CenterID and MachineID, you can create a dummy centre ID and machine ID for resident services in the master database and map it to the configurations in resident-mz.properties.