【发布时间】:2017-09-06 10:22:31
【问题描述】:
尝试使用 Azure 媒体服务 rest api。 (按照教程:https://docs.microsoft.com/en-us/azure/media-services/media-services-rest-get-started)
在我尝试创建工作之前一切正常。发送与示例相同的请求(资产 ID 和令牌除外)并获得响应: 解析请求内容失败,原因是:确保仅使用类型定义的属性名称
请求:
POST https://wamsdubclus001rest-hs.cloudapp.net/api/Jobs HTTP/1.1
Connection: Keep-Alive
Content-Type: application/json
Accept: application/json; odata=verbose
Accept-Charset: UTF-8
Authorization: Bearer token -> here i send real token
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
x-ms-version: 2.11
Content-Length: 458
Host: wamsdubclus001rest-hs.cloudapp.net
{
"Name":"TestJob",
"InputMediaAssets":[
{
"__metadata":{
"uri":"https://wamsdubclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A5168b52a-68ed-4df1-bac8-0648ce734ff6')"
}
}
],
"Tasks":[
{
"Configuration":"Adaptive Streaming",
"MediaProcessorId":"nb:mpid:UUID:ff4df607-d419-42f0-bc17-a481b1331e56",
"TaskBody":"<?xml version=\"1.0\" encoding=\"utf-8\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset> <outputAsset>JobOutputAsset(0)</outputAsset></taskBody>"
}
]
}
回复:
{
"error":{
"code":"",
"message":{
"lang":"en-US",
"value":"Parsing request content failed due to: Make sure to only use property names that are defined by the type"
}
}
}
似乎与 __metadata 属性有关。当我按照这里的指示进行操作时:Creating Job from REST API returns a request property name error,错误发生了变化:
"error":{
"code":"",
"message":{
"lang":"en-US",
"value":"Invalid input asset reference in TaskBody - "
}
}
}
不知道怎么回事,谢谢
【问题讨论】:
标签: rest azure asp.net-core azure-media-services