Creating Job from REST API returns a request property name error

我只是一个虾纸丫 提交于 2019-12-23 18:19:52

问题


I have my Asset and MediaProcessor ready. Now I am trying to encode my asset. When I send the request specified in the tutorial (http://msdn.microsoft.com/en-us/library/jj129574.aspx):

{
   "Name":"CurlTestJob",
   "InputMediaAssets":[
      {
         "__metadata":{
            "uri":"https://wamsbluclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A429967f5-4709-4377-bab2-4680ae2a0dd87')"
         }
      }
   ],
   "Tasks":[
      {
         "Configuration":"H.264 HD 720p VBR",
         "MediaProcessorId":"nb%3Ampid%3AUUID%3A2e7aa8f3-4961-4e0c-b4db-0e0439e524f5",
         "TaskBody":"<?xml version=\"1.0\" encoding=\"utf-8\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset>JobOutputAsset(0)</outputAsset></taskBody>"
}
]
}

I get the following response

{
    "odata.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";
        };
    };
}

I am using api-version 2.2

Can someone explain to me where am I wrong?


回答1:


Try setting the Header "DataServiceVersion: 2.0"

I ran into the same issue when using "DataServiceVersion: 3.0"




回答2:


The error says that properties in json file does not match the properties in the deserialized type. http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mediaservices.client.iasset.aspx shows that IAsset has property Uri, but say nothing about __metadata. You could try to change your json to

 "InputMediaAssets":[{
        "Uri":"https://wamsbluclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A429967f5-4709-4377-bab2-4680ae2a0dd87')"
  }],


来源:https://stackoverflow.com/questions/23941702/creating-job-from-rest-api-returns-a-request-property-name-error

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