Download asset file from asset in Azure media service

痴心易碎 提交于 2021-01-28 06:43:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!