首页 > 解决方案 > 时间序列洞察 API 返回无法从 System.String 转换或转换为 Microsoft.Rdx.Client.Events.Property

问题描述

嗨,我们刚刚开始使用时间序列洞察力。我们需要列出特定时间序列 id 下的属性值的指定列表。根据 azure 中的文档,我们在 post 方法中使用以下 API 来实现这一点。

https://XXXXX_EnvironmentFqdn_XXXXX.env.timeseries.azure.com/timeseries/query?api-version=2018-11-01-preview

将以下请求正文发布到 API 时

        {
          "getEvents":{
             "timeSeriesId": ["UniqueId"],
            "searchSpan": {
               "from": "2019-02-17T00:00:00Z",
              "to": "2019-02-18T00:16:50Z"
              },
             "projectedProperties": ["DesiredProp"]
          }
        }

它返回带有以下错误消息的 400 错误请求。

   {
    "error": {
    "code": "InvalidInput",
    "message": "Error converting value \"DesiredProp\" to type
    'Microsoft.Rdx.Client.Events.Property'. Path 
   'getEvents.projectedProperties[0]', line 9, position 45.\r\n---> Could 
    not        cast or convert from System.String to 
    Microsoft.Rdx.Client.Events.Property.\r\n"
      }
     }

从响应主体 API 中删除projectedProperties 属性可以正常工作,但它会返回时间序列的所有属性。

任何帮助我都会非常感激并提前感谢。

标签: azuretime-seriesiotazure-iot-hubazure-timeseries-insights

解决方案


推荐阅读