google-cloud-platformnest-apinest-device-access

How to download `CameraClipPreview` from previewUrl


I have set up pub/sub event subscriptions and I am now getting event messages into my GCP Console. My nest doorbell comes with a preview URL when certain events are triggered, here is the payload:

{
  "eventId" : "7feb3438-1dbf-4e32-849a-805d5887c48f",
  "timestamp" : "2019-01-01T00:00:01Z",
  "resourceUpdate" : {
    "name" : "enterprises/project-id/devices/device-id",
    "events" : {
      "sdm.devices.events.CameraClipPreview.ClipPreview" : {
        "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...",
        "previewUrl" : "https://previewUrl/..."
      }
    }
  }
  "userId" : "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi",
  "resourceGroup" : [
    "enterprises/project-id/devices/device-id"
  ]
}

The previewUrl comes in fine, and looks something like https://nest-camera-frontend.googleapis.com/frontend/encrypted/clippreview/AhHSDAh687gOY88G8yg8-YGgyG788786gfFtOLyGgVvdYDgdGDgdPDdpD9d9D-5IX

However when I paste this into the browser I get the 401 Bad request Google page.

Is the previewURL not meant to be accessed in a browser? How do I access/download the preview video?


Solution

  • I believe you have to download it first, can you try this, replacing {access-token} with your OAuth access token?

    curl -H 'Authorization: Bearer {access-token}' https://nest-camera-frontend.googleapis.com/frontend/encrypted/clippreview/AhHSDAh687gOY88G8yg8-YGgyG788786gfFtOLyGgVvdYDgdGDgdPDdpD9d9D-5IX