Alex c
Alex c

Reputation: 1

upload a face with ISAPI

I'm trying to upload a face using the POST method using this endpoint:

http://\<ip\>/ISAPI/Intelligent/FDLib/FaceDataRecord?format=json

And using this body:

{
"faceUR": "http://example.com/path/to/image.jpg",`
"faceLibType": "blackFD",
"FDID": 1,
"FPID": "A216627674",
"featurePointType": "face"
}

But the PostMan console always returns me the same error:

{
  "statusCode": 6,
  "statusString": "Invalid Content",
  "subStatusCode": "MessageParametersLack",
  "errorCode": 1610612761,
  "errorMsg": "FDID"
}

and I don´t know which value ISAPI expects to recieve on FDID. Maybe a specific value or data type?

I purchased a new facial hkvision recognition device. The current system works with a couple of devices from a couple of years ago and apparently the structure to communicate between them is diferent. The current system uses the following method in PHP to upload an image using ISAPI, but unlike previous models of facial recognition devices, the new one does not accept the value of 1 in the FDID field.

// Upload Face 
public function setUserImageUrl($device, $employeeNo, $imageUrl)
{
    $host = $device;

    $url  = 'ISAPI/Intelligent/FDLib/FaceDataRecord?format=json';
    $body = '{
                "faceURL": "' . $imageUrl . '",
                "faceLibType": "blackFD",
                "FDID": 1,
                "FPID": "' . $employeeNo . '",
                "featurePointType":"face"
            }';
    $response = $this->request('POST', $host, $url, $body);

    if (!$response) {
        log::info('img fail');
        return false;
    }

    return json_decode($response);
}

Upvotes: 0

Views: 550

Answers (2)

chelahmy
chelahmy

Reputation: 124

FDID is a string type.

"FDID" : "1"

Upvotes: 0

Mark
Mark

Reputation: 16

There are many reasons why you faced such issues. For example, the FDID typically refers to the Face Database ID. It's possible that the value 1 is not valid because it does not correspond to an existing face library in your new device.

Try this code, I improved it a little bit

public function setUserImageUrl($device, $employeeNo, $imageUrl, $FDID)
{
    $host = $device;

    $url  = 'ISAPI/Intelligent/FDLib/FaceDataRecord?format=json';
    $body = '{
                "faceURL": "' . $imageUrl . '",
                "faceLibType": "blackFD",
                "FDID": ' . $FDID . ',
                "FPID": "' . $employeeNo . '",
                "featurePointType":"face"
            }';
    $response = $this->request('POST', $host, $url, $body);

    if (!$response) {
        log::info('img fail');
        return false;
    }

    return json_decode($response);
}

Upvotes: -1

Related Questions