Get images from person events using the REST API
This article describes how to get event images (both scene images and cropped face images) and reference person images from person detection events.
Get Events
To start, get a list of Events using the GET Events API:
curl -X GET ""https://cv-event.real.com/events?sinceTime=EPOCH_START_TIME_IN_MS"" -H ""accept: application/json;charset=UTF-8"" -H ""X-RPC-AUTHORIZATION: USER:****"" -H ""Authorization: main""
Where:
- EPOCH_START_TIME_IN_MS is the epoch date in milliseconds. Use ""utime' chrome extension or Epoch Converter to convert the date to an Epoch date.
- utime allows values like ""yesterday"" or ""1 hour ago"".
From the API call above, get the following from one of the events:
- Person ID
- Event ID - You will need to convert the returned Event ID to base64 encoding; see below for details.
Converting UTF-8 Encoding to base64
The GET Events API will return Event IDs encoded in UTF-8, which means they'll look something like this:
81F114F2-E904-40AC-9C94-5F6954AF26C1
You need to convert the Event ID to base64 encoding either by using various websites such as this one, or by running the following command: (Linux only)
echo -n| base64
For example, using the sample UTF-8 encoded Event ID above, you would run
echo -n 81F114F2-E904-40AC-9C94-5F6954AF26C1 | base64
and the resulting base64 encoded value would be
ODFGMTE0RjItRTkwNC00MEFDLTlDOTQtNUY2OTU0QUYyNkMx
Person Face Image
To get the person's face image, you'll use the GET Person Face API:
curl -X GET ""https://cvos.real.com/person//face "" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > person.jpg
Use the Person ID from the GET Events call you made above for the
curl -X GET ""https://cvos.real.com/person/60eedc43-f56d-403b-8058-4e721c82105e/face"" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > person.jpg
Get Event Face Image
To get the event's face image, you'll use the GET Object (GET /obj/{id}/face) API:
curl -X GET ""https://cvos.real.com/obj//face "" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > event_face_image.jpg
Use the base64 encoded version of the Event ID you got from the GET Events call you made in the ""Get Events"" section above for the
For example, if GET Events returned a UTF-8 encoded Event ID of ""81F114F2-E904-40AC-9C94-5F6954AF26C1"", you would use the base64 encoded version of that value (""ODFGMTE0RjItRTkwNC00MEFDLTlDOTQtNUY2OTU0QUYyNkMx"") in the API call, so the API call would look like this:
curl -X GET ""https://cvos.real.com/obj/ODY2NTMzNzktMTUzNS00QjgyLTk2QTgtNTY1MUM5N0QzNUM0/face"" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > event_face_image.jpg
Event scene image
To get the event's scene image, you'll use the GET Object (GET /obj/{id}/sceneThumb) API:
curl -X GET ""https://cvos.real.com/obj//sceneThumb "" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > event_scene_image.jpg
Use the base64 encoded version of the Event ID you got from the GET Events call you made in the ""Get Events"" section above for the
For example, if GET Events returned a UTF-8 encoded Event ID of ""81F114F2-E904-40AC-9C94-5F6954AF26C1"", you would use the base64 encoded version of that value (""ODFGMTE0RjItRTkwNC00MEFDLTlDOTQtNUY2OTU0QUYyNkMx"") in the API call, so the API call would look like this:
curl -X GET ""https://cvos.real.com/obj/ODY2NTMzNzktMTUzNS00QjgyLTk2QTgtNTY1MUM5N0QzNUM0/sceneThumb"" -H ""accept: */*"" -H ""Authorization: main"" -H ""X-RPC-AUTHORIZATION: USERNAME:****"" > event_scene_image.jpg