在我之前的问题Azure Media Services Encoding Job Callback to URL中,建议Azure Media Services" Notifications功能支持WebHooks"可以在编码作业完成时回调到URL。我有点麻烦让它发挥作用。
采取的步骤:
nb:nepid:UUID:e9203dcb-b6a0-4b44-3cc6-69c4a573bb8d
)。{
"Name": "TestJob",
"InputMediaAssets" : [
{
"__metadata" : {"uri" : "https://media.windows.net/api/AssetsAssets('nb%3Acid%3AUUID%3A3679cd1f-74ba-4374-8d4b-8c26feba4e1d')"}
}
],
"JobNotificationSubscriptions": [
{
"NotificationEndPointId": "nb:nepid:UUID:e9203dcb-b6a0-4b44-3cc6-69c4a573bb8d",
"TargetJobState": 1
}
],
"Tasks": [
{
"Configuration": "Adaptive Streaming",
"MediaProcessorId": "nb:mpid:UUID:fa4df505-d219-42b0-bc17-a481c1441e56",
"TaskBody": "<?xml version=\"1.0\" encoding=\"utf-8\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset>JobOutputAsset(0)</outputAsset></taskBody>"
}
]
}
没有 JobNotificationSubscriptions
部分,但有了它,我只是得到回复:
"error": {
"code": "",
"message": {
"lang": "en-US",
"value": "An error occurred while processing this request."
}
}
如何让我的通知与我的工作一起工作?
答案 0 :(得分:1)
当我从2014年发布这篇文章时,我能够解决这个问题:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/cc69a85f-74b0-4d52-8e69-629ff5007169/create-an-encoding-job-with-jobnotificationsubscriptions-by-using-rest-api-got-a-response-with-400?forum=MediaServices
有三个明显的因素导致这里取得成功:
InputMediaAssets
属性需要更改为格式InputMediaAssets@odata.bind":["https://wamsos1clus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3Acee6b356-a0d0-4cfa-955b-e81cbebebb8e')"],
Content-Type=application/json;odata=verbose
更改为Content-Type=application/json
当请求在没有JobNotificationSubscriptions
部分的情况下工作时,为什么这些因素很重要仍然是个谜。