How to retrieve data from packets using Packet Manager?
In MOSIP there is a component called the Packet Manager, which has two types of implementation - a library-based implementation used by the registration client on the field to create the packet and a Rest API-based implementation used by the server-side components to read data from the packet.
All the packets created on the field are encrypted and can only be decrypted on the server-side where the private key for the same is available for decryption. In this document, we will be sharing the API details using which MOSIP’s server-side components fetch details from the packet.
Authentication and Authorization
For all the APIs in packet manager, we have implemented authorization based on a role called “REGISTRATION_PROCESSOR“. MOSIP server components have a client ID and secret key attached to them which contains this role. The MOSIP components need to authenticate themself to retrieve an authentication token and use the same in the header of every packet manager API call.
POST https://{base_URL}/v1/authmanager/authenticate/clientidsecretkey
{
"id": "string",
"metadata": {},
"request": {
"appId": "regproc",
"clientId": "mosip-regproc-client",
"secretKey": "xxxxxxxxx"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
API Endpoints
Get Packet Info
The packet info API retrieves the information about a packet when we pass the RID in the request body.
POST https://{base_URL}/commons/v1/packetmanager/info
{
"id": "string",
"metadata": {},
"request": {
"id": "<RID>"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
Get Fields
This API retrieves the field information in the id.json files available in the packet. You need to pass the correct attribute names in the field section and the RID with the correct process and source information. The above inputs can also be retrieved from the packet info response.
POST https://{base_URL}/commons/v1/packetmanager/searchFields
{
"id": "string",
"metadata": {},
"request": {
"bypassCache": false,
"fields": [
"<attribute1>",
"<attribute2>",
"<attribute3>",
"<attribute4>",
"<attribute5>"
],
"id": "<RID>",
"process": "NEW",
"source": "REGISTRATION_CLIENT"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
Get Biometrics
Using the below API you can retrieve the biometric data from the packet, the biometric data can be of the individual, officer or introducer available in the packet.
POST https://{base_URL}/commons/v1/packetmanager/biometrics
{
"id": "string",
"metadata": {},
"request": {
"bypassCache": true,
"id": "<RID>",
"person": "individualBiometrics",
"process": "NEW",
"source": "REGISTRATION_CLIENT"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
Get MetaInfo
Using the below API you can retrieve the meta info in the packet.
POST https://{base_URL}/commons/v1/packetmanager/metaInfo
{
"id": "string",
"metadata": {},
"request": {
"bypassCache": true,
"id": "<RID>",
"process": "NEW",
"source": "REGISTRATION_CLIENT"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
Get Document
Using the below API you can retrieve the document from the packet.
POST https://{base_URL}/commons/v1/packetmanager/document
{
"id": "string",
"metadata": {},
"request": {
"documentName": "proofOfAddress",
"id": "<RID>",
"process": "NEW",
"source": "REGISTRATION_CLIENT"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}
Get Audit
Using the below API you can retrieve the audit information from the packet.
POST https://{base_URL}/commons/v1/packetmanager/audits
{
"id": "string",
"metadata": {},
"request": {
"bypassCache": true,
"id": "<RID>",
"process": "NEW",
"source": "REGISTRATION_CLIENT"
},
"requesttime": "2018-12-10T06:12:52.994Z",
"version": "string"
}