Hello,
I am unsure as to how to which API to call and the payload to upload an image to hikvision device DS-K1T320EWX.
I am using HikVision sdk.
I am a novice while dealing with Hikvision device.
I wrote this code (given below) which works correctly in creating a user called John Tukey.
I am interested in adding his picture and I am unsure which API to call.
Can you kindly refer me to the correct API.
/ snippet from the main function where the user creation is called.
createJSON = R"({
"UserInfo":{
"employeeNo":"000132",
"name":"John Tukey",
"userType":"normal",
"doorRight":"1",
"RightPlan":[{"doorNo":1,"planTemplateNo":"1"}],
"gender":"male",
"localUIRight":false,
"maxOpenDoorTime":0,
"userVerifyMode":"",
"Valid":{
"enable":true,
"beginTime":"2025-02-22T00:00:00",
"endTime":"2035-02-22T23:59:59",
"timeType":"local"
}}
})";
SendXMLRequest("POST", "/ISAPI/AccessControl/UserInfo/Record?format=json", createJSON, response6, sizeof(response6));
/ the function SendXMLRequest.
bool SendXMLRequest(const char* method, const char* url, const char* xmlData, char* responseBuffer, DWORD responseSize) {
NET_DVR_XML_CONFIG_INPUT inputParam = {0};
NET_DVR_XML_CONFIG_OUTPUT outputParam = {0};
std::string fullRequest = std::string(method) + " " + url;
inputParam.dwSize = sizeof(inputParam);
inputParam.lpRequestUrl = (void*)(fullRequest.c_str());
inputParam.dwRequestUrlLen = strlen(fullRequest.c_str());
inputParam.lpInBuffer = (void*)xmlData;
inputParam.dwInBufferSize = xmlData ? strlen(xmlData) : 0;
outputParam.dwSize = sizeof(outputParam);
outputParam.lpOutBuffer = responseBuffer;
outputParam.dwOutBufferSize = responseSize;
if (!NET_DVR_STDXMLConfig(lUserID, &inputParam, &outputParam)) {
std::cout << fullRequest << " request failed!" << std::endl;
CheckAndPrintError();
return false;
}
std::cout << fullRequest << " request successful!" << std::endl;
return true;
}
I am unsure as to how to which API to call and the payload to upload an image to hikvision device DS-K1T320EWX.
I am using HikVision sdk.
I am a novice while dealing with Hikvision device.
I wrote this code (given below) which works correctly in creating a user called John Tukey.
I am interested in adding his picture and I am unsure which API to call.
Can you kindly refer me to the correct API.
/ snippet from the main function where the user creation is called.
createJSON = R"({
"UserInfo":{
"employeeNo":"000132",
"name":"John Tukey",
"userType":"normal",
"doorRight":"1",
"RightPlan":[{"doorNo":1,"planTemplateNo":"1"}],
"gender":"male",
"localUIRight":false,
"maxOpenDoorTime":0,
"userVerifyMode":"",
"Valid":{
"enable":true,
"beginTime":"2025-02-22T00:00:00",
"endTime":"2035-02-22T23:59:59",
"timeType":"local"
}}
})";
SendXMLRequest("POST", "/ISAPI/AccessControl/UserInfo/Record?format=json", createJSON, response6, sizeof(response6));
/ the function SendXMLRequest.
bool SendXMLRequest(const char* method, const char* url, const char* xmlData, char* responseBuffer, DWORD responseSize) {
NET_DVR_XML_CONFIG_INPUT inputParam = {0};
NET_DVR_XML_CONFIG_OUTPUT outputParam = {0};
std::string fullRequest = std::string(method) + " " + url;
inputParam.dwSize = sizeof(inputParam);
inputParam.lpRequestUrl = (void*)(fullRequest.c_str());
inputParam.dwRequestUrlLen = strlen(fullRequest.c_str());
inputParam.lpInBuffer = (void*)xmlData;
inputParam.dwInBufferSize = xmlData ? strlen(xmlData) : 0;
outputParam.dwSize = sizeof(outputParam);
outputParam.lpOutBuffer = responseBuffer;
outputParam.dwOutBufferSize = responseSize;
if (!NET_DVR_STDXMLConfig(lUserID, &inputParam, &outputParam)) {
std::cout << fullRequest << " request failed!" << std::endl;
CheckAndPrintError();
return false;
}
std::cout << fullRequest << " request successful!" << std::endl;
return true;
}