I have bought a biometric device to connect with my react JS.In that when I try to send request I'm getting error.
import React, { useEffect } from "react";
import axios from "axios";
const FingerprintPage = () => {
const discoverAVDM = async () => {
try {
// Make an RDSERVICE request to the RD Service
const rdServiceResponse = await axios.request({
method: "RDSERVICE",
url: "http://127.0.0.1:11100/",
});
if (rdServiceResponse.status === 200) {
console.log("RDSERVICE request successful.");
// Handle the response data if needed
console.log(rdServiceResponse.data); // Log the AVDM data
} else {
console.log("RDSERVICE request failed.");
// Handle the error or retry the request if needed
}
// Process AVDM discovery data if applicable
// ...
} catch (error) {
console.error("Error performing AVDM discovery:", error);
// Handle the error
}
};
const info = async () => {
try {
// Make an RDSERVICE request to the RD Service
const rdServiceResponse = await axios.request({
method: "DEVICEINFO",
url: "http://127.0.0.1:11100/rd/info",
});
if (rdServiceResponse.status === 200) {
console.log("info request successful.");
// Handle the response data if needed
console.log(rdServiceResponse.data); // Log the AVDM data
} else {
console.log("info request failed.");
// Handle the error or retry the request if needed
}
// Process AVDM discovery data if applicable
// ...
} catch (error) {
console.error("Error performing info :", error);
// Handle the error
}
};
const capture = async () => {
try {
const format = 0;
const pidVer = '2.0';
const rdServiceResponse = await axios.request({
method: "CAPTURE", // Custom method
url: `http://127.0.0.1:11100/rd/capture?format=${format}&pidVer=${pidVer}`,
headers: {
"Content-Type": "text/xml",
},
});
if (rdServiceResponse.status === 200) {
console.log("Capture request successful.");
// Handle the response data if needed
console.log(rdServiceResponse.data); // Log the response data
} else {
console.log("Capture request failed.");
// Handle the error or retry the request if needed
}
} catch (error) {
console.error("Error performing capture:", error);
// Handle the error
}
};
return (
<div>
<div>
{/* Add a button to initiate the AVDM discovery */}
<button onClick={discoverAVDM}>Discover AVDM</button>
<button onClick={info}>info</button>
<button onClick={capture}>capture</button>
</div>
</div>
);
};
export default FingerprintPage;
In this discoverAVDM and device info is working fine but the capture is not working. The documentation provided for me is
Following is the request format:
CAPTURE http://127.0.0.1:<rd_service_port>/<CAPTURE_path>
HOST: 127.0.0.1:<port>
<PidOptions ver="">
<Opts fCount="" fType="" iCount="" iType="" pCount="" pType="" format="" pidVer="" timeout=""
otp="" wadh="" posh="" env=""/>
<Demo></Demo>
<CustOpts>
<!-- no application should hard code these and should be configured on app or AUA servers. These
parameters can be used for any custom application authentication or for other configuration
parameters. Device providers can differentiate their service in the market by enabling advanced
algorithms that applications can take advantage of. -->
<Param name="" value="" />
</CustOpts>
</PidOptions>
PidOptions:
ver: Version of the PidOtopns spec. Currently it is “1.0”. This is necessary to allow applications to
Opts
Int fCount (optional) number of finger records to be captured (0 to 10)
Int fType (optional) ISO format (0 for FMR, 1 for FIR, 2 for both), 0 (FMR) is default
Int iCount (optional) number of iris records to be captured (0 to 2)
Int iType (optional) ISO format (0 for IIR), 0 (IIR) is default
Int pCount (optional) number of face photo records to be captured (0 to 1). Currently face
matching is not supported.
Int pType (optional) face format. Currently face matching is not supported.
Int format (mandatory) 0 for XML, 1 for Protobuf
String pidVer (mandatory) PID version
Int timeout capture timeout in milliseconds
String otp (optional) OTP value captured from user in case of 2-factor auth
String wadh (optional) If passed, RD Service should use this within PID block root element “asis”.
String env (optional) UIDAI Authentication environment for which capture is called. Valid values
are "P" (Production), "PP" (Pre-Production), and "S" (Staging). If blank or if the attribute is not
passed, RD service should default this to "P". This is provided to allow same RD service to use
different UIDAI public key based on the environment
gracefully upgrade even when RD service may be been upgraded
String posh (optional) if specific positions need to be captured, applications can pass a comma
delimited position attributes. See “posh” attribute definition in Authentication Specification for
valid values. RD Service (if showing preview) can indicate the finger using this. If passed, this
should be passed back within PID block. Default is “UNKNOWN”, meaning “any” finger/iris can
be captured
Can you help how to send this request
Top comments (0)