Unable to download phone recording in local


  @Public()
  @Get('phone/recording/:id')`Preformatted text`
  async redirectToAudioFile(
    @Res() res: express.Response,
    @Req() req: express.Request,
    @Param('id') id: string,
  ) {
    console.log('id', id);
    try {
      console.log('in try....');
      const audioUrl = this.zoomService.getRecordingAudioUrl(id);
      console.log('audioUrl', audioUrl);
      const { access_token: accessToken } =
        await this.zoomService.getAuthToken();
      if (!accessToken) {
        console.error('Access token is missing or invalid');
        return res.status(401).send('Unauthorized');
      }
 
      const downloadResponse: AxiosResponse = await axios?.get(audioUrl, {
        headers: {
          Authorization: `Bearer ${accessToken}`,
       
        },
        responseType: 'arraybuffer', // Set the responseType to 'arraybuffer' for binary data
      });
      // res.setHeader('Content-Type', 'audio/mp3');

      console.log('res.headers', downloadResponse);
      return downloadResponse
    } catch (error) {
      console.log('catch...........');
      console.log('error', error);
    }
  }

and this is my res.headers
 [Object: null prototype] {
  'access-control-allow-origin': '*',
  'content-security-policy': "default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests",
  'cross-origin-opener-policy': 'same-origin',
  'cross-origin-resource-policy': 'cross-origin',
  'origin-agent-cluster': '?1',
  'referrer-policy': 'no-referrer',
  'strict-transport-security': 'max-age=15552000; includeSubDomains',
  'x-content-type-options': 'nosniff',
  'x-dns-prefetch-control': 'off',
  'x-download-options': 'noopen',
  'x-frame-options': 'SAMEORIGIN',
  'x-permitted-cross-domain-policies': 'none',
  'x-xss-protection': '0',
  authorization: 'Bearer  token',
  'content-type': 'audio/mp3',
  'content-disposition': 'attachment; filename=audio.mp3'
}

don’t get any error
download response as a undefned what did I change to download phone recording in postman

any update on this, please…

Hi @kapil , thanks for your patience. Is this recent for you? Were you able to download successfully before?

If so, what changes do you think could have occured?

Hi @gianni.zoom
nov-10 is the last date it is worked
after that, we didn’t make any code change

@kapil are you saying it is downloading successfully in Postman, but not your own code base?

@gianni.zoom
I am not getting any responses but my response headers are the same
when I hit this URL
http://localhost:4000/v1/zoom/phone/recording/ln9bSqCUSr6cVMc3RaqRkA
and this URL
https://zoom.us/v2/phone/recording/download/ln9bSqCUSr6cVMc3RaqRkA
I get the same response headers in both
but in the local url I did not get any response and in live I get a response with audio

Can you please provide the links to the documentation for the above endpoints you had been accessing?

The correct API endpoint is https://api.zoom.us/v2/phone/recordings

Did we have any API for downloading recordings by recording ID?
And I have taken this from another developer So I don’t know which document we followed.
Which steps do I have to follow to download the recording?

Yes, this is it: Zoom Phone API

You’ll see thee download_url field in the expected successful response.

Please take a look at all the other available endpoints you may need on that page.

1 Like

@gianni.zoom, Thank you It’s Resolved Now

1 Like

Great, thanks for letting me know.

1 Like