Download event media
When an event is triggered, it can be uploaded in video format, as a snapshot, or with no media at all. You can configure these settings in the event settings API.
Important
All events are saved on the cloud for 45 days unless configured otherwise using /organizations
request
These media files play audio unless otherwise configured to be OFF using the /devices/{imei}/device-config
request.
The rest of this guide shows you how to use the Surfsight API, to quickly perform the following steps:
1. Authenticate yourself
Authenticate yourself before making any calls with the Surfsight API. For more details on authentication, see our authentication overview.
2. Get list of available events media files
Request the available events from the cloud using the GET /devices/{imei}/events
with a query parameter relevant to the time range:
curl --request POST https://api-prod.surfsight.net/v2/devices/{imei}/events?start=2021-10-15T09:00:00.000Z&end=2021-10-20T20:59:59.999Z'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {token}'
The returned response:
{
"id": 190537212,
"eventType": "sharpTurnRight",
"lat": 32.48636437,
"lon": 34.95381069,
"speed": 49.319999313354494,
"time": "2021-10-16T13:33:00.000Z",
"files": [
{
"cameraId": 1,
"fileId": "1634391180",
"fileType": "video"
},
{
"cameraId": 2,
"fileId": "1634391180",
"fileType": "video"
}
]
}
3. Download event media
Request the link to download the event media file stored on the cloud by using the GET https://api-prod.surfsight.net/v2/devices/{imei}/event-file-link
API request.
The following query parameters must be entered in which were received by /devices/{imei}/events
API response:
Component | Description | Example |
---|---|---|
fileId |
Time in UNIX of the event | 1634391180 |
cameraId |
Lens number of the device | 1 |
fileType |
Media type of the event | Video |
curl --request GET https://api-prod.surfsight.net/v2/devices/{imei}/event-file-link?fileId=1634391180&cameraId=1&fileType=video
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {token}'
Returned response:
{
"data": {
"url": "https://surfsight-organizations-production.s3.amazonaws.com/2a4837d8-5d88-43dd-94f4-894e81b476f4/{imei}/{imei}_1634391180_1.mp4?
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAUAWC3GNZKY7KPK35%2F20211020%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211020T064221Z&X
-Amz-Expires=345600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEEMaCXVzLWVhc3QtMiJHMEUCIQCgFlK1Uu4hH8NRf04jgJeF94RXr0J3nJNr3oRm0e6vdgIgOWu9O0kNXMsqmnYX
%2FKGjRJD4tx........................
},
"requestId": "45778fc6-ad06-400e-af6b-0dbcd8546002"
}
Note
The link to the media file will expire after fifteen minutes and a new request must be made in order to access the media file again.