REST API - How to save recording to playable AVI using REST API in Powershell
119
Created On 11/10/26 11:02 AM - Last Modified 11/10/26 15:55 PM
Objective
This 'Play recording' REST API call (https://docs.cyberark.com/pam-self-hosted/latest/en/content/webservices/playrecording.htm) when used in PowerShell returns a data stream.
This describes how to save this stream to a playable avi file.
Environment
11.5;12.2;12.6;13.0;13.2;14.0;14.2;14.3 Privilege Cloud Cyber-Ark API/SDK
Procedure
- Ensure that the relevant codec is installed on the machine on which you wish to play the avi file. (Ref:- https://community.cyberark.com/s/article/00005152)
- From the PVWA GUI, find the 'Name' property in 'additional properties' in the details tab of the recording listed in the monitoring tab. This will be something like 'bc3277d9-6de3-4940-952c-e9f8bfe45ae2.session'
- Run the 'Get recordings' REST API call (https://docs.cyberark.com/pam-self-hosted/latest/en/content/webservices/getrecordings.htm) and find the 'SessionID' property which is associated with the 'Name' property of the required recording.
- With reference to the 'Play recording' REST API call (https://docs.cyberark.com/pam-self-hosted/latest/en/content/webservices/playrecording.htm), run the following PowerShell command using the SessionID value obtained from the previous step in place of the recordingID: -
Invoke-RestMethod -URi "https://<pvwa URL>/PasswordVault/API/recordings/<recordingID>/Play/" -Method 'POST' -Headers $headers -Outfile "<file path>".