从Azure媒体服务中的资产下载资产文件 [英] Download asset file from asset in Azure media service
问题描述
我有一个问题.我在天蓝色媒体服务中有一项资产.资产包含资产文件.我想知道如何下载资产文件.我为此使用httparty gem.
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)
标头具有授权值.上面的请求提供了资产文件的元数据,但我想下载资产文件.谁能帮忙.谢谢.我浏览了以下文档: https://docs.microsoft.com/en-us/rest/api/media/operations/assetfile
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
推荐答案
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]
发送资产文件名称附加到SAS URL的GET请求将返回资产文件内容:
Sending a GET request with the asset file name appended to the SAS URL will return the assetfile contents:
获取 https://[storageaccount] .blob.core.windows.net/asset-[parentAssetId]/[ assetFileName ]?[queryparams]
GET https://[storageaccount].blob.core.windows.net/asset-[parentAssetId]/[assetFileName]?[queryparams]
此处是一个.NET示例.您可以忽略作业参考位,它可以与任何资产一起使用.
Here is a .NET example. You can ignore the job reference bits and it should work with any asset.
我还发现使用 Azure Media Services Explorer 非常有帮助.与Fiddler一起找出不同工作流程所需的REST请求.
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.
这篇关于从Azure媒体服务中的资产下载资产文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!