问题
I have an issue. I have an asset in the azure media service. The asset contains an asset file. I would like to know how to download the asset file. I'm using httparty gem for this.
HTTParty.get(https://<host>.restv2.<location>.media.azure.net/api/Files('<file_id>'), headers: headers)
The headers have the authorization value. The above request gives the metadata of the asset file but I would like to download the asset file. Can anyone please help. Thanks. I have gone through the below documentation: https://docs.microsoft.com/en-us/rest/api/media/operations/assetfile
回答1:
You have to create a SAS locator for the parent asset which will return a SAS URL for the asset, something like:
https://[storageaccount].blob.core.windows.net/asset-[parentAssetId]?[queryparams]
Sending a GET request with the asset file name appended to the SAS URL will return the assetfile contents:
GET https://[storageaccount].blob.core.windows.net/asset-[parentAssetId]/[assetFileName]?[queryparams]
Here is a .NET example. You can ignore the job reference bits and it should work with any asset.
I also find it very helpful to use the Azure Media Services Explorer along with Fiddler to figure out the REST requests needed for different workflows.
来源:https://stackoverflow.com/questions/49982254/download-asset-file-from-asset-in-azure-media-service